]> granicus.if.org Git - clang/commitdiff
Fixed crash and added a test and a minor output problem
authorAlexander Kornienko <alexfh@google.com>
Fri, 17 Aug 2012 17:38:39 +0000 (17:38 +0000)
committerAlexander Kornienko <alexfh@google.com>
Fri, 17 Aug 2012 17:38:39 +0000 (17:38 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162110 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Frontend/ASTConsumers.cpp
test/Tooling/clang-check-ast-dump.cpp

index 0f0d8352046d1bdd3c2779a36d92397d122c7d70..4a8f88f3282925bead54605909509ad81cd4703b 100644 (file)
@@ -58,6 +58,8 @@ namespace {
     bool shouldWalkTypesOfTypeLocs() const { return false; }
 
     bool TraverseDecl(Decl *D) {
+      if (D == NULL)
+        return false;
       if (filterMatches(D)) {
         Out.changeColor(llvm::raw_ostream::BLUE) <<
             (Dump ? "Dumping " : "Printing ") << getName(D) << ":\n";
@@ -66,6 +68,7 @@ namespace {
           D->dump(Out);
         else
           D->print(Out, /*Indentation=*/0, /*PrintInstantiation=*/true);
+        Out << "\n";
         // Don't traverse child nodes to avoid output duplication.
         return true;
       }
@@ -89,8 +92,6 @@ namespace {
 
   class ASTDeclNodeLister : public ASTConsumer,
                      public RecursiveASTVisitor<ASTDeclNodeLister> {
-    typedef RecursiveASTVisitor<ASTDeclNodeLister> base;
-
   public:
     ASTDeclNodeLister(raw_ostream *Out = NULL)
         : Out(Out ? *Out : llvm::outs()) {}
index e29072bcfe878d6958038034fc277b223cd31dd9..28dcc6eaa869f0205024a5d0d473413826875d0e 100644 (file)
@@ -37,4 +37,7 @@ public:
   int n __attribute__((aligned(1+1)));
 };
 
+// Used to fail with -ast-dump-filter X
+template<template<typename T> class C> class Z {};
+
 }