aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/TypePrinter.cpp
diff options
context:
space:
mode:
authorRoman Divacky <rdivacky@FreeBSD.org>2010-03-16 16:52:15 +0000
committerRoman Divacky <rdivacky@FreeBSD.org>2010-03-16 16:52:15 +0000
commit4a37f65f1c1373c9956d118a012943de2f61edb0 (patch)
tree52aebaff3a47b97dbac434530524c30967468412 /lib/AST/TypePrinter.cpp
parenta16e9ac1f192503038f49e0c52edd7dcb2ce023a (diff)
Notes
Diffstat (limited to 'lib/AST/TypePrinter.cpp')
-rw-r--r--lib/AST/TypePrinter.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/AST/TypePrinter.cpp b/lib/AST/TypePrinter.cpp
index 037bc14e7a91..09a61736d27e 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,