aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/ExtractAPI/API.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/ExtractAPI/API.cpp')
-rw-r--r--clang/lib/ExtractAPI/API.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/clang/lib/ExtractAPI/API.cpp b/clang/lib/ExtractAPI/API.cpp
index 45eef3d..fd9e92c 100644
--- a/clang/lib/ExtractAPI/API.cpp
+++ b/clang/lib/ExtractAPI/API.cpp
@@ -59,6 +59,31 @@ APISet::addFunction(StringRef Name, StringRef USR, PresumedLoc Loc,
Comment, Fragments, SubHeading, Signature);
}
+EnumConstantRecord *APISet::addEnumConstant(
+ EnumRecord *Enum, StringRef Name, StringRef USR, PresumedLoc Loc,
+ const AvailabilityInfo &Availability, const DocComment &Comment,
+ DeclarationFragments Declaration, DeclarationFragments SubHeading) {
+ auto Record =
+ APIRecordUniquePtr<EnumConstantRecord>(new (Allocator) EnumConstantRecord{
+ Name, USR, Loc, Availability, Comment, Declaration, SubHeading});
+ return Enum->Constants.emplace_back(std::move(Record)).get();
+}
+
+EnumRecord *APISet::addEnum(StringRef Name, StringRef USR, PresumedLoc Loc,
+ const AvailabilityInfo &Availability,
+ const DocComment &Comment,
+ DeclarationFragments Declaration,
+ DeclarationFragments SubHeading) {
+ auto Result = Enums.insert({Name, nullptr});
+ if (Result.second) {
+ // Create the record if it does not already exist.
+ auto Record = APIRecordUniquePtr<EnumRecord>(new (Allocator) EnumRecord{
+ Name, USR, Loc, Availability, Comment, Declaration, SubHeading});
+ Result.first->second = std::move(Record);
+ }
+ return Result.first->second.get();
+}
+
StringRef APISet::recordUSR(const Decl *D) {
SmallString<128> USR;
index::generateUSRForDecl(D, USR);