Fixed crash and added a test and a minor output problem

llvm-svn: 162110
This commit is contained in:
Alexander Kornienko 2012-08-17 17:38:39 +00:00
parent 91f548b04b
commit 2018618b4d
2 changed files with 6 additions and 2 deletions

View 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()) {}

View 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 {};
}