From: Alex McCarthy Date: Fri, 2 May 2014 20:24:11 +0000 (+0000) Subject: Fix null pointer segfault when calling dump() on a DeclStmt containing a VarDecl. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1f9bad0ff2391499217b7a2beb9ed92889ca3d5c;p=clang Fix null pointer segfault when calling dump() on a DeclStmt containing a VarDecl. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207867 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/ASTDumper.cpp b/lib/AST/ASTDumper.cpp index 39019792ee..76699bd568 100644 --- a/lib/AST/ASTDumper.cpp +++ b/lib/AST/ASTDumper.cpp @@ -444,6 +444,9 @@ void ASTDumper::dumpPointer(const void *Ptr) { } void ASTDumper::dumpLocation(SourceLocation Loc) { + if (!SM) + return; + ColorScope Color(*this, LocationColor); SourceLocation SpellingLoc = SM->getSpellingLoc(Loc);