diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-04-05 21:25:31 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-04-05 21:25:31 +0000 |
commit | 84139d6ef8967cfdb70d37378a7a65cc4827d44d (patch) | |
tree | 8ce02f69c076b018cc08c870a674eb57c0cf42ff /lib/AST/TypePrinter.cpp | |
parent | e32be1d07c3aadc06855ee3664343318ab263b71 (diff) |
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
Diffstat (limited to 'lib/AST/TypePrinter.cpp')
-rw-r--r-- | lib/AST/TypePrinter.cpp | 27 |
1 files changed, 15 insertions, 12 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(); } |