|
@@ -39,74 +39,6 @@
|
|
|
|
|
|
using namespace clang;
|
|
using namespace clang;
|
|
|
|
|
|
-namespace clang {
|
|
|
|
-
|
|
|
|
-/// CXXSpecialName - Records the type associated with one of the
|
|
|
|
-/// "special" kinds of declaration names in C++, e.g., constructors,
|
|
|
|
-/// destructors, and conversion functions.
|
|
|
|
-class CXXSpecialName
|
|
|
|
- : public DeclarationNameExtra, public llvm::FoldingSetNode {
|
|
|
|
-public:
|
|
|
|
- /// Type - The type associated with this declaration name.
|
|
|
|
- QualType Type;
|
|
|
|
-
|
|
|
|
- /// FETokenInfo - Extra information associated with this declaration
|
|
|
|
- /// name that can be used by the front end.
|
|
|
|
- void *FETokenInfo;
|
|
|
|
-
|
|
|
|
- void Profile(llvm::FoldingSetNodeID &ID) {
|
|
|
|
- ID.AddInteger(ExtraKindOrNumArgs);
|
|
|
|
- ID.AddPointer(Type.getAsOpaquePtr());
|
|
|
|
- }
|
|
|
|
-};
|
|
|
|
-
|
|
|
|
-/// Contains extra information for the name of a C++ deduction guide.
|
|
|
|
-class CXXDeductionGuideNameExtra : public DeclarationNameExtra,
|
|
|
|
- public llvm::FoldingSetNode {
|
|
|
|
-public:
|
|
|
|
- /// The template named by the deduction guide.
|
|
|
|
- TemplateDecl *Template;
|
|
|
|
-
|
|
|
|
- /// FETokenInfo - Extra information associated with this operator
|
|
|
|
- /// name that can be used by the front end.
|
|
|
|
- void *FETokenInfo;
|
|
|
|
-
|
|
|
|
- void Profile(llvm::FoldingSetNodeID &ID) {
|
|
|
|
- ID.AddPointer(Template);
|
|
|
|
- }
|
|
|
|
-};
|
|
|
|
-
|
|
|
|
-/// CXXOperatorIdName - Contains extra information for the name of an
|
|
|
|
-/// overloaded operator in C++, such as "operator+.
|
|
|
|
-class CXXOperatorIdName : public DeclarationNameExtra {
|
|
|
|
-public:
|
|
|
|
- /// FETokenInfo - Extra information associated with this operator
|
|
|
|
- /// name that can be used by the front end.
|
|
|
|
- void *FETokenInfo;
|
|
|
|
-};
|
|
|
|
-
|
|
|
|
-/// CXXLiteralOperatorName - Contains the actual identifier that makes up the
|
|
|
|
-/// name.
|
|
|
|
-///
|
|
|
|
-/// This identifier is stored here rather than directly in DeclarationName so as
|
|
|
|
-/// to allow Objective-C selectors, which are about a million times more common,
|
|
|
|
-/// to consume minimal memory.
|
|
|
|
-class CXXLiteralOperatorIdName
|
|
|
|
- : public DeclarationNameExtra, public llvm::FoldingSetNode {
|
|
|
|
-public:
|
|
|
|
- IdentifierInfo *ID;
|
|
|
|
-
|
|
|
|
- /// FETokenInfo - Extra information associated with this operator
|
|
|
|
- /// name that can be used by the front end.
|
|
|
|
- void *FETokenInfo;
|
|
|
|
-
|
|
|
|
- void Profile(llvm::FoldingSetNodeID &FSID) {
|
|
|
|
- FSID.AddPointer(ID);
|
|
|
|
- }
|
|
|
|
-};
|
|
|
|
-
|
|
|
|
-} // namespace clang
|
|
|
|
-
|
|
|
|
static int compareInt(unsigned A, unsigned B) {
|
|
static int compareInt(unsigned A, unsigned B) {
|
|
return (A < B ? -1 : (A > B ? 1 : 0));
|
|
return (A < B ? -1 : (A > B ? 1 : 0));
|
|
}
|
|
}
|
|
@@ -436,10 +368,6 @@ LLVM_DUMP_METHOD void DeclarationName::dump() const {
|
|
}
|
|
}
|
|
|
|
|
|
DeclarationNameTable::DeclarationNameTable(const ASTContext &C) : Ctx(C) {
|
|
DeclarationNameTable::DeclarationNameTable(const ASTContext &C) : Ctx(C) {
|
|
- CXXSpecialNamesImpl = new llvm::FoldingSet<CXXSpecialName>;
|
|
|
|
- CXXLiteralOperatorNames = new llvm::FoldingSet<CXXLiteralOperatorIdName>;
|
|
|
|
- CXXDeductionGuideNames = new llvm::FoldingSet<CXXDeductionGuideNameExtra>;
|
|
|
|
-
|
|
|
|
// Initialize the overloaded operator names.
|
|
// Initialize the overloaded operator names.
|
|
CXXOperatorNames = new (Ctx) CXXOperatorIdName[NUM_OVERLOADED_OPERATORS];
|
|
CXXOperatorNames = new (Ctx) CXXOperatorIdName[NUM_OVERLOADED_OPERATORS];
|
|
for (unsigned Op = 0; Op < NUM_OVERLOADED_OPERATORS; ++Op) {
|
|
for (unsigned Op = 0; Op < NUM_OVERLOADED_OPERATORS; ++Op) {
|
|
@@ -449,21 +377,6 @@ DeclarationNameTable::DeclarationNameTable(const ASTContext &C) : Ctx(C) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-DeclarationNameTable::~DeclarationNameTable() {
|
|
|
|
- auto *SpecialNames =
|
|
|
|
- static_cast<llvm::FoldingSet<CXXSpecialName> *>(CXXSpecialNamesImpl);
|
|
|
|
- auto *LiteralNames =
|
|
|
|
- static_cast<llvm::FoldingSet<CXXLiteralOperatorIdName> *>(
|
|
|
|
- CXXLiteralOperatorNames);
|
|
|
|
- auto *DeductionGuideNames =
|
|
|
|
- static_cast<llvm::FoldingSet<CXXDeductionGuideNameExtra> *>(
|
|
|
|
- CXXDeductionGuideNames);
|
|
|
|
-
|
|
|
|
- delete SpecialNames;
|
|
|
|
- delete LiteralNames;
|
|
|
|
- delete DeductionGuideNames;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
DeclarationName DeclarationNameTable::getCXXConstructorName(CanQualType Ty) {
|
|
DeclarationName DeclarationNameTable::getCXXConstructorName(CanQualType Ty) {
|
|
return getCXXSpecialName(DeclarationName::CXXConstructorName,
|
|
return getCXXSpecialName(DeclarationName::CXXConstructorName,
|
|
Ty.getUnqualifiedType());
|
|
Ty.getUnqualifiedType());
|
|
@@ -478,15 +391,11 @@ DeclarationName
|
|
DeclarationNameTable::getCXXDeductionGuideName(TemplateDecl *Template) {
|
|
DeclarationNameTable::getCXXDeductionGuideName(TemplateDecl *Template) {
|
|
Template = cast<TemplateDecl>(Template->getCanonicalDecl());
|
|
Template = cast<TemplateDecl>(Template->getCanonicalDecl());
|
|
|
|
|
|
- auto *DeductionGuideNames =
|
|
|
|
- static_cast<llvm::FoldingSet<CXXDeductionGuideNameExtra> *>(
|
|
|
|
- CXXDeductionGuideNames);
|
|
|
|
-
|
|
|
|
llvm::FoldingSetNodeID ID;
|
|
llvm::FoldingSetNodeID ID;
|
|
ID.AddPointer(Template);
|
|
ID.AddPointer(Template);
|
|
|
|
|
|
void *InsertPos = nullptr;
|
|
void *InsertPos = nullptr;
|
|
- if (auto *Name = DeductionGuideNames->FindNodeOrInsertPos(ID, InsertPos))
|
|
|
|
|
|
+ if (auto *Name = CXXDeductionGuideNames.FindNodeOrInsertPos(ID, InsertPos))
|
|
return DeclarationName(Name);
|
|
return DeclarationName(Name);
|
|
|
|
|
|
auto *Name = new (Ctx) CXXDeductionGuideNameExtra;
|
|
auto *Name = new (Ctx) CXXDeductionGuideNameExtra;
|
|
@@ -494,7 +403,7 @@ DeclarationNameTable::getCXXDeductionGuideName(TemplateDecl *Template) {
|
|
Name->Template = Template;
|
|
Name->Template = Template;
|
|
Name->FETokenInfo = nullptr;
|
|
Name->FETokenInfo = nullptr;
|
|
|
|
|
|
- DeductionGuideNames->InsertNode(Name, InsertPos);
|
|
|
|
|
|
+ CXXDeductionGuideNames.InsertNode(Name, InsertPos);
|
|
return DeclarationName(Name);
|
|
return DeclarationName(Name);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -509,8 +418,6 @@ DeclarationNameTable::getCXXSpecialName(DeclarationName::NameKind Kind,
|
|
assert(Kind >= DeclarationName::CXXConstructorName &&
|
|
assert(Kind >= DeclarationName::CXXConstructorName &&
|
|
Kind <= DeclarationName::CXXConversionFunctionName &&
|
|
Kind <= DeclarationName::CXXConversionFunctionName &&
|
|
"Kind must be a C++ special name kind");
|
|
"Kind must be a C++ special name kind");
|
|
- llvm::FoldingSet<CXXSpecialName> *SpecialNames
|
|
|
|
- = static_cast<llvm::FoldingSet<CXXSpecialName>*>(CXXSpecialNamesImpl);
|
|
|
|
|
|
|
|
DeclarationNameExtra::ExtraKind EKind;
|
|
DeclarationNameExtra::ExtraKind EKind;
|
|
switch (Kind) {
|
|
switch (Kind) {
|
|
@@ -535,7 +442,7 @@ DeclarationNameTable::getCXXSpecialName(DeclarationName::NameKind Kind,
|
|
ID.AddPointer(Ty.getAsOpaquePtr());
|
|
ID.AddPointer(Ty.getAsOpaquePtr());
|
|
|
|
|
|
void *InsertPos = nullptr;
|
|
void *InsertPos = nullptr;
|
|
- if (CXXSpecialName *Name = SpecialNames->FindNodeOrInsertPos(ID, InsertPos))
|
|
|
|
|
|
+ if (CXXSpecialName *Name = CXXSpecialNames.FindNodeOrInsertPos(ID, InsertPos))
|
|
return DeclarationName(Name);
|
|
return DeclarationName(Name);
|
|
|
|
|
|
CXXSpecialName *SpecialName = new (Ctx) CXXSpecialName;
|
|
CXXSpecialName *SpecialName = new (Ctx) CXXSpecialName;
|
|
@@ -543,7 +450,7 @@ DeclarationNameTable::getCXXSpecialName(DeclarationName::NameKind Kind,
|
|
SpecialName->Type = Ty;
|
|
SpecialName->Type = Ty;
|
|
SpecialName->FETokenInfo = nullptr;
|
|
SpecialName->FETokenInfo = nullptr;
|
|
|
|
|
|
- SpecialNames->InsertNode(SpecialName, InsertPos);
|
|
|
|
|
|
+ CXXSpecialNames.InsertNode(SpecialName, InsertPos);
|
|
return DeclarationName(SpecialName);
|
|
return DeclarationName(SpecialName);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -554,16 +461,12 @@ DeclarationNameTable::getCXXOperatorName(OverloadedOperatorKind Op) {
|
|
|
|
|
|
DeclarationName
|
|
DeclarationName
|
|
DeclarationNameTable::getCXXLiteralOperatorName(IdentifierInfo *II) {
|
|
DeclarationNameTable::getCXXLiteralOperatorName(IdentifierInfo *II) {
|
|
- llvm::FoldingSet<CXXLiteralOperatorIdName> *LiteralNames
|
|
|
|
- = static_cast<llvm::FoldingSet<CXXLiteralOperatorIdName>*>
|
|
|
|
- (CXXLiteralOperatorNames);
|
|
|
|
-
|
|
|
|
llvm::FoldingSetNodeID ID;
|
|
llvm::FoldingSetNodeID ID;
|
|
ID.AddPointer(II);
|
|
ID.AddPointer(II);
|
|
|
|
|
|
void *InsertPos = nullptr;
|
|
void *InsertPos = nullptr;
|
|
if (CXXLiteralOperatorIdName *Name =
|
|
if (CXXLiteralOperatorIdName *Name =
|
|
- LiteralNames->FindNodeOrInsertPos(ID, InsertPos))
|
|
|
|
|
|
+ CXXLiteralOperatorNames.FindNodeOrInsertPos(ID, InsertPos))
|
|
return DeclarationName (Name);
|
|
return DeclarationName (Name);
|
|
|
|
|
|
CXXLiteralOperatorIdName *LiteralName = new (Ctx) CXXLiteralOperatorIdName;
|
|
CXXLiteralOperatorIdName *LiteralName = new (Ctx) CXXLiteralOperatorIdName;
|
|
@@ -571,7 +474,7 @@ DeclarationNameTable::getCXXLiteralOperatorName(IdentifierInfo *II) {
|
|
LiteralName->ID = II;
|
|
LiteralName->ID = II;
|
|
LiteralName->FETokenInfo = nullptr;
|
|
LiteralName->FETokenInfo = nullptr;
|
|
|
|
|
|
- LiteralNames->InsertNode(LiteralName, InsertPos);
|
|
|
|
|
|
+ CXXLiteralOperatorNames.InsertNode(LiteralName, InsertPos);
|
|
return DeclarationName(LiteralName);
|
|
return DeclarationName(LiteralName);
|
|
}
|
|
}
|
|
|
|
|