]> granicus.if.org Git - clang/commitdiff
Only provide a source location for an anonymous tag if the location is valid
authorDouglas Gregor <dgregor@apple.com>
Fri, 28 May 2010 21:47:04 +0000 (21:47 +0000)
committerDouglas Gregor <dgregor@apple.com>
Fri, 28 May 2010 21:47:04 +0000 (21:47 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105010 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/TypePrinter.cpp

index 35a7e096994dff3bb2fbb247fd94655e37296fa8..ccf6fb936290bd3fefae14b18c30da019779d897 100644 (file)
@@ -452,11 +452,13 @@ void TypePrinter::PrintTag(TagDecl *D, std::string &InnerString) {
       if (!HasKindDecoration)
         OS << " " << D->getKindName();
 
-      PresumedLoc PLoc = D->getASTContext().getSourceManager().getPresumedLoc(
-        D->getLocation());
-      OS << " at " << PLoc.getFilename()
-         << ':' << PLoc.getLine()
-         << ':' << PLoc.getColumn();
+      if (D->getLocation().isValid()) {
+        PresumedLoc PLoc = D->getASTContext().getSourceManager().getPresumedLoc(
+          D->getLocation());
+        OS << " at " << PLoc.getFilename()
+           << ':' << PLoc.getLine()
+           << ':' << PLoc.getColumn();
+      }
     }
     
     OS << '>';