aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/AST/ASTContext.cpp65
-rw-r--r--lib/AST/ASTDiagnostic.cpp6
-rw-r--r--lib/AST/ASTImporter.cpp56
-rw-r--r--lib/AST/Decl.cpp12
-rw-r--r--lib/AST/DeclCXX.cpp2
-rw-r--r--lib/AST/NestedNameSpecifier.cpp6
-rw-r--r--lib/AST/Type.cpp108
-rw-r--r--lib/AST/TypePrinter.cpp31
-rw-r--r--lib/Checker/LLVMConventionsChecker.cpp2
-rw-r--r--lib/CodeGen/CGDebugInfo.cpp8
-rw-r--r--lib/CodeGen/CGObjCMac.cpp4
-rw-r--r--lib/Frontend/PCHReader.cpp11
-rw-r--r--lib/Frontend/PCHReaderDecl.cpp4
-rw-r--r--lib/Frontend/PCHWriter.cpp20
-rw-r--r--lib/Frontend/RewriteObjC.cpp16
-rw-r--r--lib/Sema/Sema.cpp4
-rw-r--r--lib/Sema/Sema.h3
-rw-r--r--lib/Sema/SemaCodeComplete.cpp6
-rw-r--r--lib/Sema/SemaDecl.cpp39
-rw-r--r--lib/Sema/SemaDeclAttr.cpp2
-rw-r--r--lib/Sema/SemaDeclCXX.cpp6
-rw-r--r--lib/Sema/SemaExprCXX.cpp2
-rw-r--r--lib/Sema/SemaInit.cpp4
-rw-r--r--lib/Sema/SemaTemplate.cpp78
-rw-r--r--lib/Sema/SemaTemplateInstantiate.cpp26
-rw-r--r--lib/Sema/SemaType.cpp41
-rw-r--r--lib/Sema/TreeTransform.h97
27 files changed, 305 insertions, 354 deletions
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp
index 71ef09ab18..81b56add8e 100644
--- a/lib/AST/ASTContext.cpp
+++ b/lib/AST/ASTContext.cpp
@@ -626,10 +626,6 @@ ASTContext::getTypeInfo(const Type *T) {
return getTypeInfo(cast<SubstTemplateTypeParmType>(T)->
getReplacementType().getTypePtr());
- case Type::Elaborated:
- return getTypeInfo(cast<ElaboratedType>(T)->getUnderlyingType()
- .getTypePtr());
-
case Type::Typedef: {
const TypedefDecl *Typedef = cast<TypedefType>(T)->getDecl();
if (const AlignedAttr *Aligned = Typedef->getAttr<AlignedAttr>()) {
@@ -652,8 +648,8 @@ ASTContext::getTypeInfo(const Type *T) {
return getTypeInfo(cast<DecltypeType>(T)->getUnderlyingExpr()->getType()
.getTypePtr());
- case Type::QualifiedName:
- return getTypeInfo(cast<QualifiedNameType>(T)->getNamedType().getTypePtr());
+ case Type::Elaborated:
+ return getTypeInfo(cast<ElaboratedType>(T)->getNamedType().getTypePtr());
case Type::TemplateSpecialization:
assert(getCanonicalType(T) != T &&
@@ -1890,29 +1886,28 @@ ASTContext::getTemplateSpecializationType(TemplateName Template,
}
QualType
-ASTContext::getQualifiedNameType(NestedNameSpecifier *NNS,
- QualType NamedType) {
+ASTContext::getElaboratedType(ElaboratedTypeKeyword Keyword,
+ NestedNameSpecifier *NNS,
+ QualType NamedType) {
llvm::FoldingSetNodeID ID;
- QualifiedNameType::Profile(ID, NNS, NamedType);
+ ElaboratedType::Profile(ID, Keyword, NNS, NamedType);
void *InsertPos = 0;
- QualifiedNameType *T
- = QualifiedNameTypes.FindNodeOrInsertPos(ID, InsertPos);
+ ElaboratedType *T = ElaboratedTypes.FindNodeOrInsertPos(ID, InsertPos);
if (T)
return QualType(T, 0);
QualType Canon = NamedType;
if (!Canon.isCanonical()) {
Canon = getCanonicalType(NamedType);
- QualifiedNameType *CheckT
- = QualifiedNameTypes.FindNodeOrInsertPos(ID, InsertPos);
- assert(!CheckT && "Qualified name canonical type broken");
+ ElaboratedType *CheckT = ElaboratedTypes.FindNodeOrInsertPos(ID, InsertPos);
+ assert(!CheckT && "Elaborated canonical type broken");
(void)CheckT;
}
- T = new (*this) QualifiedNameType(NNS, NamedType, Canon);
+ T = new (*this) ElaboratedType(Keyword, NNS, NamedType, Canon);
Types.push_back(T);
- QualifiedNameTypes.InsertNode(T, InsertPos);
+ ElaboratedTypes.InsertNode(T, InsertPos);
return QualType(T, 0);
}
@@ -1989,30 +1984,6 @@ ASTContext::getDependentNameType(ElaboratedTypeKeyword Keyword,
return QualType(T, 0);
}
-QualType
-ASTContext::getElaboratedType(QualType UnderlyingType,
- ElaboratedType::TagKind Tag) {
- llvm::FoldingSetNodeID ID;
- ElaboratedType::Profile(ID, UnderlyingType, Tag);
-
- void *InsertPos = 0;
- ElaboratedType *T = ElaboratedTypes.FindNodeOrInsertPos(ID, InsertPos);
- if (T)
- return QualType(T, 0);
-
- QualType Canon = UnderlyingType;
- if (!Canon.isCanonical()) {
- Canon = getCanonicalType(Canon);
- ElaboratedType *CheckT = ElaboratedTypes.FindNodeOrInsertPos(ID, InsertPos);
- assert(!CheckT && "Elaborated canonical type is broken"); (void)CheckT;
- }
-
- T = new (*this) ElaboratedType(UnderlyingType, Tag, Canon);
- Types.push_back(T);
- ElaboratedTypes.InsertNode(T, InsertPos);
- return QualType(T, 0);
-}
-
/// CmpProtocolNames - Comparison predicate for sorting protocols
/// alphabetically.
static bool CmpProtocolNames(const ObjCProtocolDecl *LHS,
@@ -2813,7 +2784,7 @@ CreateRecordDecl(ASTContext &Ctx, RecordDecl::TagKind TK, DeclContext *DC,
QualType ASTContext::getCFConstantStringType() {
if (!CFConstantStringTypeDecl) {
CFConstantStringTypeDecl =
- CreateRecordDecl(*this, TagDecl::TK_struct, TUDecl, SourceLocation(),
+ CreateRecordDecl(*this, TTK_Struct, TUDecl, SourceLocation(),
&Idents.get("NSConstantString"));
CFConstantStringTypeDecl->startDefinition();
@@ -2855,7 +2826,7 @@ void ASTContext::setCFConstantStringType(QualType T) {
QualType ASTContext::getNSConstantStringType() {
if (!NSConstantStringTypeDecl) {
NSConstantStringTypeDecl =
- CreateRecordDecl(*this, TagDecl::TK_struct, TUDecl, SourceLocation(),
+ CreateRecordDecl(*this, TTK_Struct, TUDecl, SourceLocation(),
&Idents.get("__builtin_NSString"));
NSConstantStringTypeDecl->startDefinition();
@@ -2894,7 +2865,7 @@ void ASTContext::setNSConstantStringType(QualType T) {
QualType ASTContext::getObjCFastEnumerationStateType() {
if (!ObjCFastEnumerationStateTypeDecl) {
ObjCFastEnumerationStateTypeDecl =
- CreateRecordDecl(*this, TagDecl::TK_struct, TUDecl, SourceLocation(),
+ CreateRecordDecl(*this, TTK_Struct, TUDecl, SourceLocation(),
&Idents.get("__objcFastEnumerationState"));
ObjCFastEnumerationStateTypeDecl->startDefinition();
@@ -2929,7 +2900,7 @@ QualType ASTContext::getBlockDescriptorType() {
RecordDecl *T;
// FIXME: Needs the FlagAppleBlock bit.
- T = CreateRecordDecl(*this, TagDecl::TK_struct, TUDecl, SourceLocation(),
+ T = CreateRecordDecl(*this, TTK_Struct, TUDecl, SourceLocation(),
&Idents.get("__block_descriptor"));
T->startDefinition();
@@ -2974,7 +2945,7 @@ QualType ASTContext::getBlockDescriptorExtendedType() {
RecordDecl *T;
// FIXME: Needs the FlagAppleBlock bit.
- T = CreateRecordDecl(*this, TagDecl::TK_struct, TUDecl, SourceLocation(),
+ T = CreateRecordDecl(*this, TTK_Struct, TUDecl, SourceLocation(),
&Idents.get("__block_descriptor_withcopydispose"));
T->startDefinition();
@@ -3046,7 +3017,7 @@ QualType ASTContext::BuildByRefType(const char *DeclName, QualType Ty) {
llvm::raw_svector_ostream(Name) << "__Block_byref_" <<
++UniqueBlockByRefTypeID << '_' << DeclName;
RecordDecl *T;
- T = CreateRecordDecl(*this, TagDecl::TK_struct, TUDecl, SourceLocation(),
+ T = CreateRecordDecl(*this, TTK_Struct, TUDecl, SourceLocation(),
&Idents.get(Name.str()));
T->startDefinition();
QualType Int32Ty = IntTy;
@@ -3097,7 +3068,7 @@ QualType ASTContext::getBlockParmType(
llvm::raw_svector_ostream(Name) << "__block_literal_"
<< ++UniqueBlockParmTypeID;
RecordDecl *T;
- T = CreateRecordDecl(*this, TagDecl::TK_struct, TUDecl, SourceLocation(),
+ T = CreateRecordDecl(*this, TTK_Struct, TUDecl, SourceLocation(),
&Idents.get(Name.str()));
T->startDefinition();
QualType FieldTypes[] = {
diff --git a/lib/AST/ASTDiagnostic.cpp b/lib/AST/ASTDiagnostic.cpp
index e4cd2a9c10..23aae392bb 100644
--- a/lib/AST/ASTDiagnostic.cpp
+++ b/lib/AST/ASTDiagnostic.cpp
@@ -50,12 +50,6 @@ static bool ShouldAKA(ASTContext &Context, QualType QT,
QT = cast<ElaboratedType>(Ty)->desugar();
continue;
}
-
- // ...or a qualified name type...
- if (isa<QualifiedNameType>(Ty)) {
- QT = cast<QualifiedNameType>(Ty)->desugar();
- continue;
- }
// ...or a substituted template type parameter.
if (isa<SubstTemplateTypeParmType>(Ty)) {
diff --git a/lib/AST/ASTImporter.cpp b/lib/AST/ASTImporter.cpp
index 083c1bf7d8..aae02a48cd 100644
--- a/lib/AST/ASTImporter.cpp
+++ b/lib/AST/ASTImporter.cpp
@@ -68,11 +68,10 @@ namespace {
// FIXME: DependentDecltypeType
QualType VisitRecordType(RecordType *T);
QualType VisitEnumType(EnumType *T);
- QualType VisitElaboratedType(ElaboratedType *T);
// FIXME: TemplateTypeParmType
// FIXME: SubstTemplateTypeParmType
// FIXME: TemplateSpecializationType
- QualType VisitQualifiedNameType(QualifiedNameType *T);
+ QualType VisitElaboratedType(ElaboratedType *T);
// FIXME: DependentNameType
QualType VisitObjCInterfaceType(ObjCInterfaceType *T);
QualType VisitObjCObjectPointerType(ObjCObjectPointerType *T);
@@ -532,19 +531,7 @@ static bool IsStructurallyEquivalent(StructuralEquivalenceContext &Context,
cast<TagType>(T2)->getDecl()))
return false;
break;
-
- case Type::Elaborated: {
- const ElaboratedType *Elab1 = cast<ElaboratedType>(T1);
- const ElaboratedType *Elab2 = cast<ElaboratedType>(T2);
- if (Elab1->getTagKind() != Elab2->getTagKind())
- return false;
- if (!IsStructurallyEquivalent(Context,
- Elab1->getUnderlyingType(),
- Elab2->getUnderlyingType()))
- return false;
- break;
- }
-
+
case Type::TemplateTypeParm: {
const TemplateTypeParmType *Parm1 = cast<TemplateTypeParmType>(T1);
const TemplateTypeParmType *Parm2 = cast<TemplateTypeParmType>(T2);
@@ -594,16 +581,19 @@ static bool IsStructurallyEquivalent(StructuralEquivalenceContext &Context,
break;
}
- case Type::QualifiedName: {
- const QualifiedNameType *Qual1 = cast<QualifiedNameType>(T1);
- const QualifiedNameType *Qual2 = cast<QualifiedNameType>(T2);
+ case Type::Elaborated: {
+ const ElaboratedType *Elab1 = cast<ElaboratedType>(T1);
+ const ElaboratedType *Elab2 = cast<ElaboratedType>(T2);
+ // CHECKME: what if a keyword is ETK_None or ETK_typename ?
+ if (Elab1->getKeyword() != Elab2->getKeyword())
+ return false;
if (!IsStructurallyEquivalent(Context,
- Qual1->getQualifier(),
- Qual2->getQualifier()))
+ Elab1->getQualifier(),
+ Elab2->getQualifier()))
return false;
if (!IsStructurallyEquivalent(Context,
- Qual1->getNamedType(),
- Qual2->getNamedType()))
+ Elab1->getNamedType(),
+ Elab2->getNamedType()))
return false;
break;
}
@@ -1293,24 +1283,20 @@ QualType ASTNodeImporter::VisitEnumType(EnumType *T) {
}
QualType ASTNodeImporter::VisitElaboratedType(ElaboratedType *T) {
- QualType ToUnderlyingType = Importer.Import(T->getUnderlyingType());
- if (ToUnderlyingType.isNull())
- return QualType();
-
- return Importer.getToContext().getElaboratedType(ToUnderlyingType,
- T->getTagKind());
-}
-
-QualType ASTNodeImporter::VisitQualifiedNameType(QualifiedNameType *T) {
- NestedNameSpecifier *ToQualifier = Importer.Import(T->getQualifier());
- if (!ToQualifier)
- return QualType();
+ NestedNameSpecifier *ToQualifier = 0;
+ // Note: the qualifier in an ElaboratedType is optional.
+ if (T->getQualifier()) {
+ ToQualifier = Importer.Import(T->getQualifier());
+ if (!ToQualifier)
+ return QualType();
+ }
QualType ToNamedType = Importer.Import(T->getNamedType());
if (ToNamedType.isNull())
return QualType();
- return Importer.getToContext().getQualifiedNameType(ToQualifier, ToNamedType);
+ return Importer.getToContext().getElaboratedType(T->getKeyword(),
+ ToQualifier, ToNamedType);
}
QualType ASTNodeImporter::VisitObjCInterfaceType(ObjCInterfaceType *T) {
diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp
index 25f5fb7797..28332bdb9a 100644
--- a/lib/AST/Decl.cpp
+++ b/lib/AST/Decl.cpp
@@ -23,7 +23,7 @@
#include "clang/AST/PrettyPrinter.h"
#include "clang/Basic/Builtins.h"
#include "clang/Basic/IdentifierTable.h"
-#include "clang/Parse/DeclSpec.h"
+#include "clang/Basic/Specifiers.h"
#include "llvm/Support/ErrorHandling.h"
using namespace clang;
@@ -1520,16 +1520,6 @@ TagDecl* TagDecl::getDefinition() const {
return 0;
}
-TagDecl::TagKind TagDecl::getTagKindForTypeSpec(unsigned TypeSpec) {
- switch (TypeSpec) {
- default: llvm_unreachable("unexpected type specifier");
- case DeclSpec::TST_struct: return TK_struct;
- case DeclSpec::TST_class: return TK_class;
- case DeclSpec::TST_union: return TK_union;
- case DeclSpec::TST_enum: return TK_enum;
- }
-}
-
void TagDecl::setQualifierInfo(NestedNameSpecifier *Qualifier,
SourceRange QualifierRange) {
if (Qualifier) {
diff --git a/lib/AST/DeclCXX.cpp b/lib/AST/DeclCXX.cpp
index a279eda38a..8d9be130b1 100644
--- a/lib/AST/DeclCXX.cpp
+++ b/lib/AST/DeclCXX.cpp
@@ -137,7 +137,7 @@ CXXRecordDecl::setBases(CXXBaseSpecifier const * const *Bases,
data().VBases[I] =
CXXBaseSpecifier(VBaseClassDecl->getSourceRange(), true,
- VBaseClassDecl->getTagKind() == RecordDecl::TK_class,
+ VBaseClassDecl->getTagKind() == TTK_Class,
VBases[I]->getAccessSpecifier(), VBaseType);
}
}
diff --git a/lib/AST/NestedNameSpecifier.cpp b/lib/AST/NestedNameSpecifier.cpp
index 45518e98bc..d6594cdfd0 100644
--- a/lib/AST/NestedNameSpecifier.cpp
+++ b/lib/AST/NestedNameSpecifier.cpp
@@ -145,14 +145,14 @@ NestedNameSpecifier::print(llvm::raw_ostream &OS,
InnerPolicy.SuppressScope = true;
// Nested-name-specifiers are intended to contain minimally-qualified
- // types. An actual QualifiedNameType will not occur, since we'll store
+ // types. An actual ElaboratedType will not occur, since we'll store
// just the type that is referred to in the nested-name-specifier (e.g.,
// a TypedefType, TagType, etc.). However, when we are dealing with
// dependent template-id types (e.g., Outer<T>::template Inner<U>),
// the type requires its own nested-name-specifier for uniqueness, so we
// suppress that nested-name-specifier during printing.
- assert(!isa<QualifiedNameType>(T) &&
- "Qualified name type in nested-name-specifier");
+ assert(!isa<ElaboratedType>(T) &&
+ "Elaborated type in nested-name-specifier");
if (const TemplateSpecializationType *SpecType
= dyn_cast<TemplateSpecializationType>(T)) {
// Print the template name without its corresponding
diff --git a/lib/AST/Type.cpp b/lib/AST/Type.cpp
index 73f0e91dab..843785e634 100644
--- a/lib/AST/Type.cpp
+++ b/lib/AST/Type.cpp
@@ -18,6 +18,7 @@
#include "clang/AST/DeclTemplate.h"
#include "clang/AST/Expr.h"
#include "clang/AST/PrettyPrinter.h"
+#include "clang/Basic/Specifiers.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/raw_ostream.h"
using namespace clang;
@@ -764,36 +765,105 @@ bool Type::isSpecifierType() const {
case TemplateTypeParm:
case SubstTemplateTypeParm:
case TemplateSpecialization:
- case QualifiedName:
+ case Elaborated:
case DependentName:
case ObjCInterface:
case ObjCObjectPointer:
- case Elaborated:
return true;
default:
return false;
}
}
-bool Type::isElaboratedTypeSpecifier() const {
- if (getTypeClass() == Elaborated)
+TypeWithKeyword::~TypeWithKeyword() {
+}
+
+ElaboratedTypeKeyword
+TypeWithKeyword::getKeywordForTypeSpec(unsigned TypeSpec) {
+ switch (TypeSpec) {
+ default: return ETK_None;
+ case TST_typename: return ETK_Typename;
+ case TST_class: return ETK_Class;
+ case TST_struct: return ETK_Struct;
+ case TST_union: return ETK_Union;
+ case TST_enum: return ETK_Enum;
+ }
+}
+
+TagTypeKind
+TypeWithKeyword::getTagTypeKindForTypeSpec(unsigned TypeSpec) {
+ switch(TypeSpec) {
+ case TST_class: return TTK_Class;
+ case TST_struct: return TTK_Struct;
+ case TST_union: return TTK_Union;
+ case TST_enum: return TTK_Enum;
+ default: llvm_unreachable("Type specifier is not a tag type kind.");
+ }
+}
+
+ElaboratedTypeKeyword
+TypeWithKeyword::getKeywordForTagTypeKind(TagTypeKind Kind) {
+ switch (Kind) {
+ case TTK_Class: return ETK_Class;
+ case TTK_Struct: return ETK_Struct;
+ case TTK_Union: return ETK_Union;
+ case TTK_Enum: return ETK_Enum;
+ }
+ llvm_unreachable("Unknown tag type kind.");
+}
+
+TagTypeKind
+TypeWithKeyword::getTagTypeKindForKeyword(ElaboratedTypeKeyword Keyword) {
+ switch (Keyword) {
+ case ETK_Class: return TTK_Class;
+ case ETK_Struct: return TTK_Struct;
+ case ETK_Union: return TTK_Union;
+ case ETK_Enum: return TTK_Enum;
+ case ETK_None: // Fall through.
+ case ETK_Typename:
+ llvm_unreachable("Elaborated type keyword is not a tag type kind.");
+ }
+ llvm_unreachable("Unknown elaborated type keyword.");
+}
+
+bool
+TypeWithKeyword::KeywordIsTagTypeKind(ElaboratedTypeKeyword Keyword) {
+ switch (Keyword) {
+ case ETK_None:
+ case ETK_Typename:
+ return false;
+ case ETK_Class:
+ case ETK_Struct:
+ case ETK_Union:
+ case ETK_Enum:
return true;
-
- if (const DependentNameType *Dependent = dyn_cast<DependentNameType>(this)) {
- switch (Dependent->getKeyword()) {
- case ETK_None:
- case ETK_Typename:
- return false;
-
- case ETK_Class:
- case ETK_Struct:
- case ETK_Union:
- case ETK_Enum:
- return true;
- }
}
-
- return false;
+ llvm_unreachable("Unknown elaborated type keyword.");
+}
+
+const char*
+TypeWithKeyword::getKeywordName(ElaboratedTypeKeyword Keyword) {
+ switch (Keyword) {
+ default: llvm_unreachable("Unknown elaborated type keyword.");
+ case ETK_None: return "";
+ case ETK_Typename: return "typename";
+ case ETK_Class: return "class";
+ case ETK_Struct: return "struct";
+ case ETK_Union: return "union";
+ case ETK_Enum: return "enum";
+ }
+}
+
+bool Type::isElaboratedTypeSpecifier() const {
+ ElaboratedTypeKeyword Keyword;
+ if (const ElaboratedType *Elab = dyn_cast<ElaboratedType>(this))
+ Keyword = Elab->getKeyword();
+ else if (const DependentNameType *DepName = dyn_cast<DependentNameType>(this))
+ Keyword = DepName->getKeyword();
+ else
+ return false;
+
+ return TypeWithKeyword::KeywordIsTagTypeKind(Keyword);
}
const char *Type::getTypeClassName() const {
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);
diff --git a/lib/Checker/LLVMConventionsChecker.cpp b/lib/Checker/LLVMConventionsChecker.cpp
index 14f0fc1280..39ded43127 100644
--- a/lib/Checker/LLVMConventionsChecker.cpp
+++ b/lib/Checker/LLVMConventionsChecker.cpp
@@ -47,7 +47,7 @@ static bool InStdNamespace(const Decl *D) {
}
static bool IsStdString(QualType T) {
- if (const QualifiedNameType *QT = T->getAs<QualifiedNameType>())
+ if (const ElaboratedType *QT = T->getAs<ElaboratedType>())
T = QT->getNamedType();
const TypedefType *TT = T->getAs<TypedefType>();
diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp
index cb6efe881c..43f47a005d 100644
--- a/lib/CodeGen/CGDebugInfo.cpp
+++ b/lib/CodeGen/CGDebugInfo.cpp
@@ -1154,15 +1154,12 @@ static QualType UnwrapTypeForDebugInfo(QualType T) {
case Type::Decltype:
T = cast<DecltypeType>(T)->getUnderlyingType();
break;
- case Type::QualifiedName:
- T = cast<QualifiedNameType>(T)->getNamedType();
+ case Type::Elaborated:
+ T = cast<ElaboratedType>(T)->getNamedType();
break;
case Type::SubstTemplateTypeParm:
T = cast<SubstTemplateTypeParmType>(T)->getReplacementType();
break;
- case Type::Elaborated:
- T = cast<ElaboratedType>(T)->getUnderlyingType();
- break;
}
assert(T != LastT && "Type unwrapping failed to unwrap!");
@@ -1253,7 +1250,6 @@ llvm::DIType CGDebugInfo::CreateTypeNode(QualType Ty,
case Type::TemplateSpecialization:
case Type::Elaborated:
- case Type::QualifiedName:
case Type::SubstTemplateTypeParm:
case Type::TypeOfExpr:
case Type::TypeOf:
diff --git a/lib/CodeGen/CGObjCMac.cpp b/lib/CodeGen/CGObjCMac.cpp
index 77eabbfd41..5140bb6d9d 100644
--- a/lib/CodeGen/CGObjCMac.cpp
+++ b/lib/CodeGen/CGObjCMac.cpp
@@ -3669,7 +3669,7 @@ ObjCCommonTypesHelper::ObjCCommonTypesHelper(CodeGen::CodeGenModule &cgm)
// id self;
// Class cls;
// }
- RecordDecl *RD = RecordDecl::Create(Ctx, TagDecl::TK_struct,
+ RecordDecl *RD = RecordDecl::Create(Ctx, TTK_Struct,
Ctx.getTranslationUnitDecl(),
SourceLocation(),
&Ctx.Idents.get("_objc_super"));
@@ -4131,7 +4131,7 @@ ObjCNonFragileABITypesHelper::ObjCNonFragileABITypesHelper(CodeGen::CodeGenModul
// };
// First the clang type for struct _message_ref_t
- RecordDecl *RD = RecordDecl::Create(Ctx, TagDecl::TK_struct,
+ RecordDecl *RD = RecordDecl::Create(Ctx, TTK_Struct,
Ctx.getTranslationUnitDecl(),
SourceLocation(),
&Ctx.Idents.get("_message_ref_t"));
diff --git a/lib/Frontend/PCHReader.cpp b/lib/Frontend/PCHReader.cpp
index 6e4e28eed1..c329f7b64f 100644
--- a/lib/Frontend/PCHReader.cpp
+++ b/lib/Frontend/PCHReader.cpp
@@ -2165,8 +2165,10 @@ QualType PCHReader::ReadTypeRecord(uint64_t Offset) {
return QualType();
}
unsigned Tag = Record[1];
- return Context->getElaboratedType(GetType(Record[0]),
- (ElaboratedType::TagKind) Tag);
+ // FIXME: Deserialize the qualifier (C++ only)
+ return Context->getElaboratedType((ElaboratedTypeKeyword) Tag,
+ /* NNS */ 0,
+ GetType(Record[0]));
}
case pch::TYPE_OBJC_INTERFACE: {
@@ -2334,9 +2336,6 @@ void TypeLocReader::VisitRecordTypeLoc(RecordTypeLoc TL) {
void TypeLocReader::VisitEnumTypeLoc(EnumTypeLoc TL) {
TL.setNameLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
}
-void TypeLocReader::VisitElaboratedTypeLoc(ElaboratedTypeLoc TL) {
- TL.setNameLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
-}
void TypeLocReader::VisitTemplateTypeParmTypeLoc(TemplateTypeParmTypeLoc TL) {
TL.setNameLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
}
@@ -2354,7 +2353,7 @@ void TypeLocReader::VisitTemplateSpecializationTypeLoc(
Reader.GetTemplateArgumentLocInfo(TL.getTypePtr()->getArg(i).getKind(),
Record, Idx));
}
-void TypeLocReader::VisitQualifiedNameTypeLoc(QualifiedNameTypeLoc TL) {
+void TypeLocReader::VisitElaboratedTypeLoc(ElaboratedTypeLoc TL) {
TL.setNameLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
}
void TypeLocReader::VisitInjectedClassNameTypeLoc(InjectedClassNameTypeLoc TL) {
diff --git a/lib/Frontend/PCHReaderDecl.cpp b/lib/Frontend/PCHReaderDecl.cpp
index c4f9622db8..3f91d0cafb 100644
--- a/lib/Frontend/PCHReaderDecl.cpp
+++ b/lib/Frontend/PCHReaderDecl.cpp
@@ -865,7 +865,7 @@ Decl *PCHReader::ReadDeclRecord(uint64_t Offset, unsigned Index) {
D = EnumDecl::Create(*Context, 0, SourceLocation(), 0, SourceLocation(), 0);
break;
case pch::DECL_RECORD:
- D = RecordDecl::Create(*Context, TagDecl::TK_struct, 0, SourceLocation(),
+ D = RecordDecl::Create(*Context, TTK_Struct, 0, SourceLocation(),
0, SourceLocation(), 0);
break;
case pch::DECL_ENUM_CONSTANT:
@@ -913,7 +913,7 @@ Decl *PCHReader::ReadDeclRecord(uint64_t Offset, unsigned Index) {
DeclarationName());
break;
case pch::DECL_CXX_RECORD:
- D = CXXRecordDecl::Create(*Context, TagDecl::TK_struct, 0,
+ D = CXXRecordDecl::Create(*Context, TTK_Struct, 0,
SourceLocation(), 0, SourceLocation(), 0);
break;
case pch::DECL_CXX_METHOD:
diff --git a/lib/Frontend/PCHWriter.cpp b/lib/Frontend/PCHWriter.cpp
index dc1fb23ac0..b323dcf4b8 100644
--- a/lib/Frontend/PCHWriter.cpp
+++ b/lib/Frontend/PCHWriter.cpp
@@ -213,12 +213,6 @@ void PCHTypeWriter::VisitEnumType(const EnumType *T) {
Code = pch::TYPE_ENUM;
}
-void PCHTypeWriter::VisitElaboratedType(const ElaboratedType *T) {
- Writer.AddTypeRef(T->getUnderlyingType(), Record);
- Record.push_back(T->getTagKind());
- Code = pch::TYPE_ELABORATED;
-}
-
void
PCHTypeWriter::VisitSubstTemplateTypeParmType(
const SubstTemplateTypeParmType *T) {
@@ -234,9 +228,12 @@ PCHTypeWriter::VisitTemplateSpecializationType(
assert(false && "Cannot serialize template specialization types");
}
-void PCHTypeWriter::VisitQualifiedNameType(const QualifiedNameType *T) {
- // FIXME: Serialize this type (C++ only)
- assert(false && "Cannot serialize qualified name types");
+void PCHTypeWriter::VisitElaboratedType(const ElaboratedType *T) {
+ Writer.AddTypeRef(T->getNamedType(), Record);
+ Record.push_back(T->getKeyword());
+ // FIXME: Serialize the qualifier (C++ only)
+ assert(T->getQualifier() == 0 && "Cannot serialize qualified name types");
+ Code = pch::TYPE_ELABORATED;
}
void PCHTypeWriter::VisitInjectedClassNameType(const InjectedClassNameType *T) {
@@ -383,9 +380,6 @@ void TypeLocWriter::VisitRecordTypeLoc(RecordTypeLoc TL) {
void TypeLocWriter::VisitEnumTypeLoc(EnumTypeLoc TL) {
Writer.AddSourceLocation(TL.getNameLoc(), Record);
}
-void TypeLocWriter::VisitElaboratedTypeLoc(ElaboratedTypeLoc TL) {
- Writer.AddSourceLocation(TL.getNameLoc(), Record);
-}
void TypeLocWriter::VisitTemplateTypeParmTypeLoc(TemplateTypeParmTypeLoc TL) {
Writer.AddSourceLocation(TL.getNameLoc(), Record);
}
@@ -401,7 +395,7 @@ void TypeLocWriter::VisitTemplateSpecializationTypeLoc(
for (unsigned i = 0, e = TL.getNumArgs(); i != e; ++i)
Writer.AddTemplateArgumentLoc(TL.getArgLoc(i), Record);
}
-void TypeLocWriter::VisitQualifiedNameTypeLoc(QualifiedNameTypeLoc TL) {
+void TypeLocWriter::VisitElaboratedTypeLoc(ElaboratedTypeLoc TL) {
Writer.AddSourceLocation(TL.getNameLoc(), Record);
}
void TypeLocWriter::VisitInjectedClassNameTyp