From d1d34bafef56b732b461e12032eaf030e609f55a Mon Sep 17 00:00:00 2001 From: Zixu Wang Date: Fri, 25 Mar 2022 15:15:08 -0700 Subject: [clang][extract-api] Add Objective-C protocol support Add support for Objective-C protocol declarations in ExtractAPI. Depends on D122446 Differential Revision: https://reviews.llvm.org/D122511 --- clang/lib/ExtractAPI/API.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'clang/lib/ExtractAPI/API.cpp') diff --git a/clang/lib/ExtractAPI/API.cpp b/clang/lib/ExtractAPI/API.cpp index 2456022..1c9314c 100644 --- a/clang/lib/ExtractAPI/API.cpp +++ b/clang/lib/ExtractAPI/API.cpp @@ -161,6 +161,20 @@ ObjCInstanceVariableRecord *APISet::addObjCInstanceVariable( return Container->Ivars.emplace_back(std::move(Record)).get(); } +ObjCProtocolRecord *APISet::addObjCProtocol( + StringRef Name, StringRef USR, PresumedLoc Loc, + const AvailabilityInfo &Availability, const DocComment &Comment, + DeclarationFragments Declaration, DeclarationFragments SubHeading) { + auto Result = ObjCProtocols.insert({Name, nullptr}); + if (Result.second) { + // Create the record if it does not already exist. + auto Record = std::make_unique( + 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); @@ -193,3 +207,4 @@ void ObjCPropertyRecord::anchor() {} void ObjCInstanceVariableRecord::anchor() {} void ObjCMethodRecord::anchor() {} void ObjCInterfaceRecord::anchor() {} +void ObjCProtocolRecord::anchor() {} -- cgit v1.1