diff options
Diffstat (limited to 'lib/AST/TypePrinter.cpp')
-rw-r--r-- | lib/AST/TypePrinter.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/AST/TypePrinter.cpp b/lib/AST/TypePrinter.cpp index 037bc14e7a..09a61736d2 100644 --- a/lib/AST/TypePrinter.cpp +++ b/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, |