[cfe-commits] r162110 - in /cfe/trunk: lib/Frontend/ASTConsumers.cpp test/Tooling/clang-check-ast-dump.cpp

Alexander Kornienko alexfh at google.com
Fri Aug 17 10:38:39 PDT 2012


Author: alexfh
Date: Fri Aug 17 12:38:39 2012
New Revision: 162110

URL: http://llvm.org/viewvc/llvm-project?rev=162110&view=rev
Log:
Fixed crash and added a test and a minor output problem

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=162110&r1=162109&r2=162110&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/ASTConsumers.cpp (original)
+++ cfe/trunk/lib/Frontend/ASTConsumers.cpp Fri Aug 17 12:38:39 2012
@@ -58,6 +58,8 @@
     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 @@
           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 @@
 
   class ASTDeclNodeLister : public ASTConsumer,
                      public RecursiveASTVisitor<ASTDeclNodeLister> {
-    typedef RecursiveASTVisitor<ASTDeclNodeLister> base;
-
   public:
     ASTDeclNodeLister(raw_ostream *Out = NULL)
         : Out(Out ? *Out : llvm::outs()) {}

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=162110&r1=162109&r2=162110&view=diff
==============================================================================
--- cfe/trunk/test/Tooling/clang-check-ast-dump.cpp (original)
+++ cfe/trunk/test/Tooling/clang-check-ast-dump.cpp Fri Aug 17 12:38:39 2012
@@ -37,4 +37,7 @@
   int n __attribute__((aligned(1+1)));
 };
 
+// Used to fail with -ast-dump-filter X
+template<template<typename T> class C> class Z {};
+
 }





More information about the cfe-commits mailing list