[analyzer] Fix function macro crash
authorKristof Umann <dkszelethus@gmail.com>
Tue, 12 Mar 2019 10:03:32 +0000 (10:03 +0000)
committerKristof Umann <dkszelethus@gmail.com>
Tue, 12 Mar 2019 10:03:32 +0000 (10:03 +0000)
commit9f92b3d081228be2a4133bbf8b850f9aa88470cf
tree7c3fb743718bcfc9ad2190b92f9866ae51b49c0f
parent20ea21c6ede8426be9832d684409a2388e2ca31a
[analyzer] Fix function macro crash

When there is a functor-like macro which is passed as parameter to another
"function" macro then its parameters are not listed at the place of expansion:

#define foo(x) int bar() { return x; }
#define hello(fvar) fvar(0)
hello(foo)
int main() { 1 / bar(); }

Expansion of hello(foo) asserted Clang, because it expected an l_paren token in
the 3rd line after "foo", since it is a function-like token.

Patch by Tibor Brunner!

Differential Revision: https://reviews.llvm.org/D57893

llvm-svn: 355903
clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
clang/test/Analysis/Inputs/expected-plists/plist-macros-with-expansion.cpp.plist
clang/test/Analysis/plist-macros-with-expansion.cpp