Extend the type printing policy to allow one to turn off the printing
of file locations for anonymous tag types (e.g., "enum <anonymous at
t.h:15:6>"), which can get rather long.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100470 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaCodeComplete.cpp b/lib/Sema/SemaCodeComplete.cpp
index 317eef8..df14aa7 100644
--- a/lib/Sema/SemaCodeComplete.cpp
+++ b/lib/Sema/SemaCodeComplete.cpp
@@ -1338,8 +1338,11 @@
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);
}