aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-objdump/llvm-objdump.cpp
diff options
context:
space:
mode:
authorMatthias Gehre <gehre.matthias@gmail.com>2020-04-07 23:36:53 +0200
committerMatthias Gehre <gehre.matthias@gmail.com>2020-04-09 19:26:41 +0200
commiteaa55590945a130131a47a4d2b89e3bbdfced79e (patch)
tree27811c3c13dd1c62c5f0d92a18e0fac7a4dd8cab /llvm/tools/llvm-objdump/llvm-objdump.cpp
parent61ff29637501afcd7476e52064f7a266a95c6e28 (diff)
downloadllvm-eaa55590945a130131a47a4d2b89e3bbdfced79e.zip
llvm-eaa55590945a130131a47a4d2b89e3bbdfced79e.tar.gz
llvm-eaa55590945a130131a47a4d2b89e3bbdfced79e.tar.bz2
[clang-tidy] misc-unused-parameters: Don't remove parameter from lambda
Summary: Previously, the check would fix ``` using fn = void(int); void f(fn *); void test() { // CHECK-MESSAGES: :[[@LINE+2]]:12: warning: parameter 'I' is unused // CHECK-FIXES: {{^}} f([](int /*I*/) { f([](int I) { return; }); } ``` into `f([]() { return; });` which breaks compilation. Now the check is disabled from Lambdas. The AST is not so easy to use. For ``` auto l = [](int) { return; }; f(l); ``` one gets ``` `-CallExpr <line:7:5, col:8> 'void' |-ImplicitCastExpr <col:5> 'void (*)(fn *)' <FunctionToPointerDecay> | `-DeclRefExpr <col:5> 'void (fn *)' lvalue Function 0x55a91a545e28 'f' 'void (fn *)' `-ImplicitCastExpr <col:7> 'void (*)(int)' <UserDefinedConversion> `-CXXMemberCallExpr <col:7> 'void (*)(int)' `-MemberExpr <col:7> '<bound member function type>' .operator void (*)(int) 0x55a91a546850 `-ImplicitCastExpr <col:7> 'const (lambda at line:6:14)' lvalue <NoOp> `-DeclRefExpr <col:7> '(lambda at line:6:14)':'(lambda at line:6:14)' lvalue Var 0x55a91a5461c0 'l' '(lambda at line:6:14)':'(lambda at line:6:14)' ``` There is no direct use of the `operator()(int I)` of the lambda, so the `!Indexer->getOtherRefs(Function).empty()` does not fire. In the future, we might be able to use the conversion operator `operator void (*)(int)` to mark the call operator as having an "other ref". Reviewers: aaron.ballman, alexfh, hokein, njames93 Subscribers: xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D77680
Diffstat (limited to 'llvm/tools/llvm-objdump/llvm-objdump.cpp')
0 files changed, 0 insertions, 0 deletions