summaryrefslogtreecommitdiffstats
path: root/lldb/test/expression_command/call-function/TestCallUserDefinedFunction.py
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2015-10-27 19:47:40 +0000
committerNico Weber <nicolasweber@gmx.de>2015-10-27 19:47:40 +0000
commit0e631639be8c20dae7e8bf259c271ba97c825b0a (patch)
tree9f4d90ea20e4902c586f63da2e76d4500e37010d /lldb/test/expression_command/call-function/TestCallUserDefinedFunction.py
parent305a7d3f449f003acf4e76ca36c64008841b7a62 (diff)
downloadbcm5719-llvm-0e631639be8c20dae7e8bf259c271ba97c825b0a.tar.gz
bcm5719-llvm-0e631639be8c20dae7e8bf259c271ba97c825b0a.zip
Tweak how -Wunused-value interacts with macros
1. Make the warning more strict in C mode. r172696 added code to suppress warnings from macro expansions in system headers, which checks `SourceMgr.isMacroBodyExpansion(E->IgnoreParens()->getExprLoc())`. Consider this snippet: #define FOO(x) (x) void f(int a) { FOO(a); } In C, the line `FOO(a)` is an `ImplicitCastExpr(ParenExpr(DeclRefExpr))`, while it's just a `ParenExpr(DeclRefExpr)` in C++. So in C++, `E->IgnoreParens()` returns the `DeclRefExpr` and the check tests the SourceLoc of `a`. In C, the `ImplicitCastExpr` has the effect of checking the SourceLoc of `FOO`, which is a macro body expansion, which causes the diagnostic to be skipped. It looks unintentional that clang does different things for C and C++ here, so use `IgnoreParenImpCasts` instead of `IgnoreParens` here. This has the effect of the warning firing more often than previously in C code – it now fires as often as it fires in C++ code. 2. Suppress the warning if it would warn on `UNREFERENCED_PARAMETER`. `UNREFERENCED_PARAMETER` is a commonly used macro on Windows and it happens to uselessly trigger -Wunused-value. As discussed in the thread "rfc: winnt.h's UNREFERENCED_PARAMETER() vs clang's -Wunused-value" on cfe-dev, fix this by special-casing this specific macro. (This costs a string comparison and some fast-path lexing per warning, but the warning is emitted rarely. It fires once in Windows.h itself, so this code runs at least once per TU including Windows.h, but it doesn't run hundreds of times.) http://reviews.llvm.org/D13969 llvm-svn: 251441
Diffstat (limited to 'lldb/test/expression_command/call-function/TestCallUserDefinedFunction.py')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud