diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2017-10-04 11:58:30 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2017-10-04 11:58:30 +0200 |
commit | f4514f356a08a4108c5cdfb1d12855df297097a4 (patch) | |
tree | dd1f5dbd987f4e375d670a1ea7c5234a4a212051 | |
parent | b18545688a6399dbf89b05dae585e15a75b8302a (diff) |
Fix test, and add missing TraverseFunctionDecl base case
Change-Id: I31f238fe931e8d890cd70b1a1eb52f042f487a76
-rw-r--r-- | compilerplugins/clang/blockblock.cxx | 7 | ||||
-rw-r--r-- | compilerplugins/clang/test/blockblock.cxx | 2 |
2 files changed, 8 insertions, 1 deletions
diff --git a/compilerplugins/clang/blockblock.cxx b/compilerplugins/clang/blockblock.cxx index 3d5d69c2ab57..a4ac7ffb8edb 100644 --- a/compilerplugins/clang/blockblock.cxx +++ b/compilerplugins/clang/blockblock.cxx @@ -35,6 +35,13 @@ public: TraverseDecl(compiler.getASTContext().getTranslationUnitDecl()); } + bool TraverseFunctionDecl(FunctionDecl * decl) { + if (containsPreprocessingConditionalInclusion(decl->getSourceRange())) { + return true; + } + return RecursiveASTVisitor::TraverseFunctionDecl(decl); + } + bool TraverseCXXMethodDecl(CXXMethodDecl * decl) { if (containsPreprocessingConditionalInclusion(decl->getSourceRange())) { return true; diff --git a/compilerplugins/clang/test/blockblock.cxx b/compilerplugins/clang/test/blockblock.cxx index 89733103eb58..2463ccaa7fd5 100644 --- a/compilerplugins/clang/test/blockblock.cxx +++ b/compilerplugins/clang/test/blockblock.cxx @@ -9,7 +9,7 @@ int f(bool b1, bool b2) { if (b1 || b2) { -#if 1 +#if 0 if (b1) #endif { |