[cfe-commits] r167155 - in /cfe/trunk: lib/Frontend/ASTConsumers.cpp test/Tooling/clang-check-ast-dump.cpp
Alexander Kornienko
alexfh at google.com
Wed Oct 31 11:46:31 PDT 2012
Author: alexfh
Date: Wed Oct 31 13:46:31 2012
New Revision: 167155
URL: http://llvm.org/viewvc/llvm-project?rev=167155&view=rev
Log:
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
Modified:
cfe/trunk/lib/Frontend/ASTConsumers.cpp
cfe/trunk/test/Tooling/clang-check-ast-dump.cpp
Modified: cfe/trunk/lib/Frontend/ASTConsumers.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/ASTConsumers.cpp?rev=167155&r1=167154&r2=167155&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/ASTConsumers.cpp (original)
+++ cfe/trunk/lib/Frontend/ASTConsumers.cpp Wed Oct 31 13:46:31 2012
@@ -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();
Modified: cfe/trunk/test/Tooling/clang-check-ast-dump.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Tooling/clang-check-ast-dump.cpp?rev=167155&r1=167154&r2=167155&view=diff
==============================================================================
--- cfe/trunk/test/Tooling/clang-check-ast-dump.cpp (original)
+++ cfe/trunk/test/Tooling/clang-check-ast-dump.cpp Wed Oct 31 13:46:31 2012
@@ -26,6 +26,9 @@
// RUN: clang-check -ast-dump -ast-dump-filter test_namespace::TheClass::n "%s" -- 2>&1 | FileCheck -check-prefix CHECK-ATTR %s
// CHECK-ATTR: test_namespace
// CHECK-ATTR-NEXT: int n __attribute__((aligned((BinaryOperator
+//
+// RUN: clang-check -ast-dump -ast-dump-filter test_namespace::AfterNullNode "%s" -- 2>&1 | FileCheck -check-prefix CHECK-AFTER-NULL %s
+// CHECK-AFTER-NULL: class AfterNullNode
namespace test_namespace {
@@ -40,4 +43,7 @@
// Used to fail with -ast-dump-filter X
template<template<typename T> class C> class Z {};
+// Check that traversal continues after the previous construct.
+class AfterNullNode {};
+
}
More information about the cfe-commits
mailing list