diff options
author | Zixu Wang <zixu_wang@apple.com> | 2022-03-25 15:15:08 -0700 |
---|---|---|
committer | Zixu Wang <zixu_wang@apple.com> | 2022-03-29 14:44:49 -0700 |
commit | d1d34bafef56b732b461e12032eaf030e609f55a (patch) | |
tree | 8360785bdf0fa068133c2916679cbb5550af3b8c /clang/lib/ExtractAPI/API.cpp | |
parent | 122638d97d913edcdfa8ccf921eb5929498166c7 (diff) | |
download | llvm-d1d34bafef56b732b461e12032eaf030e609f55a.zip llvm-d1d34bafef56b732b461e12032eaf030e609f55a.tar.gz llvm-d1d34bafef56b732b461e12032eaf030e609f55a.tar.bz2 |
[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
Diffstat (limited to 'clang/lib/ExtractAPI/API.cpp')
-rw-r--r-- | clang/lib/ExtractAPI/API.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
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<ObjCProtocolRecord>( + 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() {} |