From 16834e88b9102b7c6562a6bb8a8931a58ebda900 Mon Sep 17 00:00:00 2001 From: Douglas Gregor <dgregor@apple.com> Date: Fri, 28 May 2010 21:47:04 +0000 Subject: [PATCH] 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 --- lib/AST/TypePrinter.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/AST/TypePrinter.cpp b/lib/AST/TypePrinter.cpp index 35a7e096994..ccf6fb93629 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 << '>'; -- GitLab