]> granicus.if.org Git - clang/commitdiff
Fix null pointer segfault when calling dump() on a DeclStmt containing a VarDecl.
authorAlex McCarthy <alexmc@google.com>
Fri, 2 May 2014 20:24:11 +0000 (20:24 +0000)
committerAlex McCarthy <alexmc@google.com>
Fri, 2 May 2014 20:24:11 +0000 (20:24 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207867 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/ASTDumper.cpp

index 39019792ee5e483de1c69e9be8234a3a38004706..76699bd56880fa75650ebec1edd9d6b081690c8d 100644 (file)
@@ -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);