Fix for -ast-dump-filter
Summary:
-ast-dump-filter implementation used to stop AST traversal after traversing a NULL Decl node.
Added test and fixed.
Reviewers: djasper, klimek, rsmith
Reviewed By: djasper
CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D93
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167155 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Frontend/ASTConsumers.cpp b/lib/Frontend/ASTConsumers.cpp
index 4a8f88f..882d400 100644
--- a/lib/Frontend/ASTConsumers.cpp
+++ b/lib/Frontend/ASTConsumers.cpp
@@ -58,9 +58,7 @@
bool shouldWalkTypesOfTypeLocs() const { return false; }
bool TraverseDecl(Decl *D) {
- if (D == NULL)
- return false;
- if (filterMatches(D)) {
+ if (D != NULL && filterMatches(D)) {
Out.changeColor(llvm::raw_ostream::BLUE) <<
(Dump ? "Dumping " : "Printing ") << getName(D) << ":\n";
Out.resetColor();