diff options
author | Abramo Bagnara <abramo.bagnara@gmail.com> | 2010-05-11 21:36:43 +0000 |
---|---|---|
committer | Abramo Bagnara <abramo.bagnara@gmail.com> | 2010-05-11 21:36:43 +0000 |
commit | 465d41b92b2c862f3062c412a0538db65c6a2661 (patch) | |
tree | 0743a1451f3715b8acabca167d0a0bcc357550bd /lib/AST/TypePrinter.cpp | |
parent | 380c2139959d8608782292984b457640a143a70d (diff) |
Merged Elaborated and QualifiedName types.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103517 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/TypePrinter.cpp')
-rw-r--r-- | lib/AST/TypePrinter.cpp | 31 |
1 files changed, 10 insertions, 21 deletions
diff --git a/lib/AST/TypePrinter.cpp b/lib/AST/TypePrinter.cpp index 915d7af9a8..0478d4e39c 100644 --- a/lib/AST/TypePrinter.cpp +++ b/lib/AST/TypePrinter.cpp @@ -497,16 +497,6 @@ void TypePrinter::PrintEnum(const EnumType *T, std::string &S) { PrintTag(T->getDecl(), S); } -void TypePrinter::PrintElaborated(const ElaboratedType *T, std::string &S) { - Print(T->getUnderlyingType(), 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, std::string &S) { if (!S.empty()) // Prefix the basic type, e.g. 'parmname X'. @@ -549,13 +539,17 @@ void TypePrinter::PrintInjectedClassName(const InjectedClassNameType *T, PrintTemplateSpecialization(T->getInjectedTST(), S); } -void TypePrinter::PrintQualifiedName(const QualifiedNameType *T, - std::string &S) { +void TypePrinter::PrintElaborated(const ElaboratedType *T, std::string &S) { std::string MyString; { llvm::raw_string_ostream OS(MyString); - T->getQualifier()->print(OS, Policy); + OS << TypeWithKeyword::getKeywordName(T->getKeyword()); + if (T->getKeyword() != ETK_None) + OS << " "; + NestedNameSpecifier* Qualifier = T->getQualifier(); + if (Qualifier) + Qualifier->print(OS, Policy); } std::string TypeStr; @@ -575,14 +569,9 @@ void TypePrinter::PrintDependentName(const DependentNameType *T, std::string &S) { llvm::raw_string_ostream OS(MyString); - switch (T->getKeyword()) { - case ETK_None: break; - case ETK_Typename: OS << "typename "; break; - case ETK_Class: OS << "class "; break; - case ETK_Struct: OS << "struct "; break; - case ETK_Union: OS << "union "; break; - case ETK_Enum: OS << "enum "; break; - } + OS << TypeWithKeyword::getKeywordName(T->getKeyword()); + if (T->getKeyword() != ETK_None) + OS << " "; T->getQualifier()->print(OS, Policy); |