HomePhabricator

PR44684: Look through parens and similar constructs when determining whether a…

Authored by rsmith on Wed, Feb 5, 7:01 PM.

Description

PR44684: Look through parens and similar constructs when determining whether a call is to a builtin.

We already had a general mechanism to do this but for some reason
weren't using it. In passing, check for the other unary operators that
can intervene in a reasonably-direct function call (we already handled
'&' but missed '*' and '+').

This reverts commit aaae6b1b617378362462c1685e754813ed82b394,
reinstating af80b8ccc5772c14920d4554b7ca7e15f2fad1c4, with a fix to
clang-tidy.

Event Timeline

Hi, a bisect seems to show that this patche causes the build error we're seeing at https://logs.chromium.org/logs/fuchsia/buildbucket/cr-buildbucket.appspot.com/8889138534807714304/+/steps/build/0/steps/build_fuchsia/0/steps/ninja/0/steps/zircon/0/logs/raw_io.output_failure_raw_summary_/0

[16461/51551] CXX user-x64-clang/obj/system/dev/audio/lib/simple-audio-stream/tests/sa-unittest-test.sas-test.cc.o
FAILED: user-x64-clang/obj/system/dev/audio/lib/simple-audio-stream/tests/sa-unittest-test.sas-test.cc.o
../../../recipe_cleanup/clang0QV_mP/bin/clang++ -MD -MF user-x64-clang/obj/system/dev/audio/lib/simple-audio-stream/tests/sa-unittest-test.sas-test.cc.o.d -o user-x64-clang/obj/system/dev/audio/lib/simple-audio-stream/tests/sa-unittest-test.sas-test.cc.o -DTOOLCHAIN_VERSION=/b/s/w/ir/k/recipe_cleanup/clang0QV_mP/bin -DZX_ASSERT_LEVEL=2 -DWITH_FRAME_POINTERS=1 -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS=1 -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS -D_ALL_SOURCE -I../../zircon/system/public -Igen/system/fidl/fuchsia-hardware-audio/fuchsia-hardware-audio.json/include -I../../zircon/system/fidl/fuchsia-hardware-audio/include -I../../zircon/system/ulib/fidl/include -I../../zircon/system/ulib/fidl/include -I../../zircon/system/ulib/fit/include -I../../zircon/system/ulib/zx/include -I../../zircon/system/ulib/zircon/include -Iuser.vdso-x64-clang.shlib/gen -I../../zircon/system/ulib/async/include -I../../zircon/system/ulib/async/include -I../../zircon/system/ulib/async-loop/include -I../../zircon/system/ulib/async-loop/include -I../../zircon/system/ulib/async-loop/include -I../../zircon/system/ulib/ddktl/include -I../../zircon/system/ulib/fbl/include -I../../zircon/system/dev/audio/lib/simple-audio-stream/include -I../../zircon/system/dev/lib/dev-operation/include -I../../zircon/system/ulib/ddk/include -Igen/system/fidl/fuchsia-hardware-nand/fuchsia-hardware-nand.c/include -I../../zircon/system/fidl/fuchsia-hardware-nand/include -Igen/system/fidl/fuchsia-device/fuchsia-device.c/include -I../../zircon/system/fidl/fuchsia-device/include -Igen/system/fidl/fuchsia-device-manager/fuchsia-device-manager.c/include -I../../zircon/system/fidl/fuchsia-device-manager/include -Igen/system/fidl/fuchsia-hardware-usb-peripheral/fuchsia-hardware-usb-peripheral.c/include -I../../zircon/system/fidl/fuchsia-hardware-usb-peripheral/include -I../../zircon/system/ulib/fidl-async/include -I../../zircon/system/ulib/sync/include -I../../zircon/system/dev/lib/fake_ddk/include -Igen/system/fidl/fuchsia-device/fuchsia-device.json/include -Igen/system/fidl/fuchsia-device-manager/fuchsia-device-manager.json/include -I../../zircon/system/fidl/fuchsia-device-manager/include -I../../zircon/system/fidl/fuchsia-device/include -I../../zircon/system/ulib/audio-driver-proto/include -I../../zircon/system/ulib/audio-proto-utils/include -I../../zircon/system/ulib/audio-utils/include -I../../zircon/system/ulib/fzl/include -I../../zircon/system/ulib/zircon-internal/include -I../../zircon/system/ulib/zxtest/include -I../../zircon/system/ulib/c/include -fno-common --target=x86_64-fuchsia -mcx16 -march=x86-64 -fcrash-diagnostics-dir=clang-crashreports -fcolor-diagnostics -ffile-prefix-map=/b/s/w/ir/k/fuchsia/out/default.zircon=. -ffile-prefix-map=/b/s/w/ir/k/fuchsia/out=.. -ffile-prefix-map=/b/s/w/ir/k/fuchsia=../.. -no-canonical-prefixes -O2 -g3 -Wall -Wextra -Wno-unused-parameter -Wno-address-of-packed-member -Wnewline-eof -Wno-unknown-warning-option -Wno-c99-designator -Wno-int-in-bool-context -Wno-range-loop-analysis -fno-omit-frame-pointer -ffunction-sections -fdata-sections -Wthread-safety -Wimplicit-fallthrough -fvisibility=hidden -ftrivial-auto-var-init=pattern -Werror -Wno-error=deprecated-declarations -idirafter ../../zircon/third_party/ulib/musl/include -idirafter ../../zircon/third_party/ulib/musl/include -std=c++17 -Wconversion -Wno-sign-conversion -Wextra-semi -Wno-deprecated-copy -ftemplate-backtrace-limit=0 -fno-exceptions -fno-rtti -fno-threadsafe-statics -fvisibility-inlines-hidden -c ../../zircon/system/dev/audio/lib/simple-audio-stream/tests/sas-test.cc
In file included from ../../zircon/system/dev/audio/lib/simple-audio-stream/tests/sas-test.cc:8:
In file included from ../../zircon/system/dev/audio/lib/simple-audio-stream/include/lib/simple-audio-stream/simple-audio-stream.h:11:
../../zircon/system/ulib/async/include/lib/async/cpp/task.h:225:7: error: calling function 'ProcessRingNotification' requires holding mutex 'self->instance_->domain_token_' exclusively [-Werror,-Wthread-safety-analysis]
(self->instance_->*method)();
^
../../zircon/system/ulib/async/include/lib/async/cpp/task.h:218:38: note: in instantiation of member function 'async::TaskClosureMethod<audio::MockSimpleAudio, &audio::MockSimpleAudio::ProcessRingNotification>::CallHandler' requested here
: TaskBase(&TaskClosureMethod::CallHandler), instance_(instance) {}
^
../../zircon/system/dev/audio/lib/simple-audio-stream/tests/sas-test.cc:126:33: note: in instantiation of member function 'async::TaskClosureMethod<audio::MockSimpleAudio, &audio::MockSimpleAudio::ProcessRingNotification>::TaskClosureMethod' requested here
TA_GUARDED(domain_token()){this};
^
1 error generated.

I'm unsure how this could lead to a trigger of -Wthread-safety-analysis, but without digging in too much yet, my guess is that it's due to some change in Expr::getReferencedDeclOfCallee(). Do you know if anything stands out? Thanks.

Builder: https://ci.chromium.org/p/fuchsia/builders/ci/clang_toolchain.fuchsia-x64-debug-subbuild/b8889138534807714304