diff options
| author | John McCall <rjmccall@apple.com> | 2010-03-10 21:05:46 +0000 |
|---|---|---|
| committer | John McCall <rjmccall@apple.com> | 2010-03-10 21:05:46 +0000 |
| commit | c9d4a84c2a9b35d1ea6739205f735c809661c526 (patch) | |
| tree | ca986638aba1a143f4de16f695fe3fac734bc0ea /clang/lib | |
| parent | 703b12d62fe62da6d40200932e79ae7eb7d40766 (diff) | |
| download | bcm5719-llvm-c9d4a84c2a9b35d1ea6739205f735c809661c526.tar.gz bcm5719-llvm-c9d4a84c2a9b35d1ea6739205f735c809661c526.zip | |
Suppress the tag when printing an ElaboratedType if the language options
claim this is C. We don't make ElaboratedTypes in C, but sometimes
the language options during pretty-print lie to us.
The rewriter should really be fixed to not rely on how types are pretty-printed,
though.
llvm-svn: 98189
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/AST/TypePrinter.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/AST/TypePrinter.cpp b/clang/lib/AST/TypePrinter.cpp index 037bc14e7a9..09a61736d27 100644 --- a/clang/lib/AST/TypePrinter.cpp +++ b/clang/lib/AST/TypePrinter.cpp @@ -474,7 +474,12 @@ void TypePrinter::PrintEnum(const EnumType *T, std::string &S) { void TypePrinter::PrintElaborated(const ElaboratedType *T, std::string &S) { Print(T->getUnderlyingType(), S); - S = std::string(T->getNameForTagKind(T->getTagKind())) + ' ' + S; + + // We don't actually make these in C, but the language options + // sometimes lie to us -- for example, if someone calls + // QualType::getAsString(). Just suppress the redundant tag if so. + if (Policy.LangOpts.CPlusPlus) + S = std::string(T->getNameForTagKind(T->getTagKind())) + ' ' + S; } void TypePrinter::PrintTemplateTypeParm(const TemplateTypeParmType *T, |

