From: Douglas Gregor Date: Fri, 28 May 2010 21:47:04 +0000 (+0000) Subject: Only provide a source location for an anonymous tag if the location is valid X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=16834e88b9102b7c6562a6bb8a8931a58ebda900;p=clang Only provide a source location for an anonymous tag if the location is valid git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105010 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/TypePrinter.cpp b/lib/AST/TypePrinter.cpp index 35a7e09699..ccf6fb9362 100644 --- a/lib/AST/TypePrinter.cpp +++ b/lib/AST/TypePrinter.cpp @@ -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 << '>';