aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/ExtractAPI/API.cpp
diff options
context:
space:
mode:
authorDaniel Grumberg <dgrumberg@apple.com>2022-04-11 19:53:33 +0100
committerDaniel Grumberg <dgrumberg@apple.com>2022-04-12 20:42:17 +0100
commit7443a504bf6c22b83727c1e43c82c4165b2d5db5 (patch)
tree156b059f0d42ab6a5a463993ce560ed321870ac5 /clang/lib/ExtractAPI/API.cpp
parent8edaf25986a451f29d8102739c8438ca1e7c1005 (diff)
downloadllvm-7443a504bf6c22b83727c1e43c82c4165b2d5db5.zip
llvm-7443a504bf6c22b83727c1e43c82c4165b2d5db5.tar.gz
llvm-7443a504bf6c22b83727c1e43c82c4165b2d5db5.tar.bz2
[clang][extract-api] Add support for true anonymous enums
Anonymous enums without a typedef should have a "(anonymous)" identifier. Differential Revision: https://reviews.llvm.org/D123533
Diffstat (limited to 'clang/lib/ExtractAPI/API.cpp')
-rw-r--r--clang/lib/ExtractAPI/API.cpp36
1 files changed, 18 insertions, 18 deletions
diff --git a/clang/lib/ExtractAPI/API.cpp b/clang/lib/ExtractAPI/API.cpp
index 10d723d..073e36f 100644
--- a/clang/lib/ExtractAPI/API.cpp
+++ b/clang/lib/ExtractAPI/API.cpp
@@ -28,13 +28,13 @@ namespace {
template <typename RecordTy, typename... CtorArgsTy>
RecordTy *addTopLevelRecord(APISet::RecordMap<RecordTy> &RecordMap,
- StringRef Name, CtorArgsTy &&...CtorArgs) {
- auto Result = RecordMap.insert({Name, nullptr});
+ StringRef USR, CtorArgsTy &&...CtorArgs) {
+ auto Result = RecordMap.insert({USR, nullptr});
// Create the record if it does not already exist
if (Result.second)
Result.first->second =
- std::make_unique<RecordTy>(Name, std::forward<CtorArgsTy>(CtorArgs)...);
+ std::make_unique<RecordTy>(USR, std::forward<CtorArgsTy>(CtorArgs)...);
return Result.first->second.get();
}
@@ -46,7 +46,7 @@ APISet::addGlobalVar(StringRef Name, StringRef USR, PresumedLoc Loc,
const AvailabilityInfo &Availability, LinkageInfo Linkage,
const DocComment &Comment, DeclarationFragments Fragments,
DeclarationFragments SubHeading) {
- return addTopLevelRecord(GlobalVariables, Name, USR, Loc, Availability,
+ return addTopLevelRecord(GlobalVariables, USR, Name, Loc, Availability,
Linkage, Comment, Fragments, SubHeading);
}
@@ -55,7 +55,7 @@ GlobalFunctionRecord *APISet::addGlobalFunction(
const AvailabilityInfo &Availability, LinkageInfo Linkage,
const DocComment &Comment, DeclarationFragments Fragments,
DeclarationFragments SubHeading, FunctionSignature Signature) {
- return addTopLevelRecord(GlobalFunctions, Name, USR, Loc, Availability,
+ return addTopLevelRecord(GlobalFunctions, USR, Name, Loc, Availability,
Linkage, Comment, Fragments, SubHeading, Signature);
}
@@ -64,7 +64,7 @@ EnumConstantRecord *APISet::addEnumConstant(
const AvailabilityInfo &Availability, const DocComment &Comment,
DeclarationFragments Declaration, DeclarationFragments SubHeading) {
auto Record = std::make_unique<EnumConstantRecord>(
- Name, USR, Loc, Availability, Comment, Declaration, SubHeading);
+ USR, Name, Loc, Availability, Comment, Declaration, SubHeading);
return Enum->Constants.emplace_back(std::move(Record)).get();
}
@@ -73,7 +73,7 @@ EnumRecord *APISet::addEnum(StringRef Name, StringRef USR, PresumedLoc Loc,
const DocComment &Comment,
DeclarationFragments Declaration,
DeclarationFragments SubHeading) {
- return addTopLevelRecord(Enums, Name, USR, Loc, Availability, Comment,
+ return addTopLevelRecord(Enums, USR, Name, Loc, Availability, Comment,
Declaration, SubHeading);
}
@@ -84,7 +84,7 @@ StructFieldRecord *APISet::addStructField(StructRecord *Struct, StringRef Name,
DeclarationFragments Declaration,
DeclarationFragments SubHeading) {
auto Record = std::make_unique<StructFieldRecord>(
- Name, USR, Loc, Availability, Comment, Declaration, SubHeading);
+ USR, Name, Loc, Availability, Comment, Declaration, SubHeading);
return Struct->Fields.emplace_back(std::move(Record)).get();
}
@@ -93,7 +93,7 @@ StructRecord *APISet::addStruct(StringRef Name, StringRef USR, PresumedLoc Loc,
const DocComment &Comment,
DeclarationFragments Declaration,
DeclarationFragments SubHeading) {
- return addTopLevelRecord(Structs, Name, USR, Loc, Availability, Comment,
+ return addTopLevelRecord(Structs, USR, Name, Loc, Availability, Comment,
Declaration, SubHeading);
}
@@ -103,12 +103,12 @@ ObjCCategoryRecord *APISet::addObjCCategory(
DeclarationFragments Declaration, DeclarationFragments SubHeading,
SymbolReference Interface) {
// Create the category record.
- auto *Record = addTopLevelRecord(ObjCCategories, Name, USR, Loc, Availability,
+ auto *Record = addTopLevelRecord(ObjCCategories, USR, Name, Loc, Availability,
Comment, Declaration, SubHeading, Interface);
// If this category is extending a known interface, associate it with the
// ObjCInterfaceRecord.
- auto It = ObjCInterfaces.find(Interface.Name);
+ auto It = ObjCInterfaces.find(Interface.USR);
if (It != ObjCInterfaces.end())
It->second->Categories.push_back(Record);
@@ -120,7 +120,7 @@ ObjCInterfaceRecord *APISet::addObjCInterface(
const AvailabilityInfo &Availability, LinkageInfo Linkage,
const DocComment &Comment, DeclarationFragments Declaration,
DeclarationFragments SubHeading, SymbolReference SuperClass) {
- return addTopLevelRecord(ObjCInterfaces, Name, USR, Loc, Availability,
+ return addTopLevelRecord(ObjCInterfaces, USR, Name, Loc, Availability,
Linkage, Comment, Declaration, SubHeading,
SuperClass);
}
@@ -132,7 +132,7 @@ ObjCMethodRecord *APISet::addObjCMethod(
DeclarationFragments SubHeading, FunctionSignature Signature,
bool IsInstanceMethod) {
auto Record = std::make_unique<ObjCMethodRecord>(
- Name, USR, Loc, Availability, Comment, Declaration, SubHeading, Signature,
+ USR, Name, Loc, Availability, Comment, Declaration, SubHeading, Signature,
IsInstanceMethod);
return Container->Methods.emplace_back(std::move(Record)).get();
}
@@ -145,7 +145,7 @@ ObjCPropertyRecord *APISet::addObjCProperty(
ObjCPropertyRecord::AttributeKind Attributes, StringRef GetterName,
StringRef SetterName, bool IsOptional) {
auto Record = std::make_unique<ObjCPropertyRecord>(
- Name, USR, Loc, Availability, Comment, Declaration, SubHeading,
+ USR, Name, Loc, Availability, Comment, Declaration, SubHeading,
Attributes, GetterName, SetterName, IsOptional);
return Container->Properties.emplace_back(std::move(Record)).get();
}
@@ -157,7 +157,7 @@ ObjCInstanceVariableRecord *APISet::addObjCInstanceVariable(
DeclarationFragments SubHeading,
ObjCInstanceVariableRecord::AccessControl Access) {
auto Record = std::make_unique<ObjCInstanceVariableRecord>(
- Name, USR, Loc, Availability, Comment, Declaration, SubHeading, Access);
+ USR, Name, Loc, Availability, Comment, Declaration, SubHeading, Access);
return Container->Ivars.emplace_back(std::move(Record)).get();
}
@@ -165,7 +165,7 @@ ObjCProtocolRecord *APISet::addObjCProtocol(
StringRef Name, StringRef USR, PresumedLoc Loc,
const AvailabilityInfo &Availability, const DocComment &Comment,
DeclarationFragments Declaration, DeclarationFragments SubHeading) {
- return addTopLevelRecord(ObjCProtocols, Name, USR, Loc, Availability, Comment,
+ return addTopLevelRecord(ObjCProtocols, USR, Name, Loc, Availability, Comment,
Declaration, SubHeading);
}
@@ -173,7 +173,7 @@ MacroDefinitionRecord *
APISet::addMacroDefinition(StringRef Name, StringRef USR, PresumedLoc Loc,
DeclarationFragments Declaration,
DeclarationFragments SubHeading) {
- return addTopLevelRecord(Macros, Name, USR, Loc, Declaration, SubHeading);
+ return addTopLevelRecord(Macros, USR, Name, Loc, Declaration, SubHeading);
}
TypedefRecord *APISet::addTypedef(StringRef Name, StringRef USR,
@@ -183,7 +183,7 @@ TypedefRecord *APISet::addTypedef(StringRef Name, StringRef USR,
DeclarationFragments Declaration,
DeclarationFragments SubHeading,
SymbolReference UnderlyingType) {
- return addTopLevelRecord(Typedefs, Name, USR, Loc, Availability, Comment,
+ return addTopLevelRecord(Typedefs, USR, Name, Loc, Availability, Comment,
Declaration, SubHeading, UnderlyingType);
}