diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/AST/TypePrinter.cpp | 27 | ||||
-rw-r--r-- | lib/Sema/SemaCodeComplete.cpp | 5 |
2 files changed, 19 insertions, 13 deletions
diff --git a/lib/AST/TypePrinter.cpp b/lib/AST/TypePrinter.cpp index 4cf0922ee3..340e373af1 100644 --- a/lib/AST/TypePrinter.cpp +++ b/lib/AST/TypePrinter.cpp @@ -442,18 +442,21 @@ void TypePrinter::PrintTag(TagDecl *D, std::string &InnerString) { llvm::raw_string_ostream OS(Buffer); OS << "<anonymous"; - // Suppress the redundant tag keyword if we just printed one. - // We don't have to worry about ElaboratedTypes here because you can't - // refer to an anonymous type with one. - if (!HasKindDecoration) - OS << " " << D->getKindName(); - - PresumedLoc PLoc = D->getASTContext().getSourceManager().getPresumedLoc( - D->getLocation()); - OS << " at " << PLoc.getFilename() - << ':' << PLoc.getLine() - << ':' << PLoc.getColumn() - << '>'; + if (Policy.AnonymousTagLocations) { + // Suppress the redundant tag keyword if we just printed one. + // We don't have to worry about ElaboratedTypes here because you can't + // refer to an anonymous type with one. + if (!HasKindDecoration) + OS << " " << D->getKindName(); + + PresumedLoc PLoc = D->getASTContext().getSourceManager().getPresumedLoc( + D->getLocation()); + OS << " at " << PLoc.getFilename() + << ':' << PLoc.getLine() + << ':' << PLoc.getColumn(); + } + + OS << '>'; OS.flush(); } diff --git a/lib/Sema/SemaCodeComplete.cpp b/lib/Sema/SemaCodeComplete.cpp index 317eef8d60..df14aa7fc5 100644 --- a/lib/Sema/SemaCodeComplete.cpp +++ b/lib/Sema/SemaCodeComplete.cpp @@ -1338,8 +1338,11 @@ static void AddResultTypeChunk(ASTContext &Context, if (T.isNull() || Context.hasSameType(T, Context.DependentTy)) return; + PrintingPolicy Policy(Context.PrintingPolicy); + Policy.AnonymousTagLocations = false; + std::string TypeStr; - T.getAsStringInternal(TypeStr, Context.PrintingPolicy); + T.getAsStringInternal(TypeStr, Policy); Result->AddResultTypeChunk(TypeStr); } |