Only provide a source location for an anonymous tag if the location is valid

llvm-svn: 105010
This commit is contained in:
Douglas Gregor 2010-05-28 21:47:04 +00:00
parent 0fa67e479a
commit 7e5aeac10a
1 changed files with 7 additions and 5 deletions

View 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 << '>';