[clang] [APINotes] Upstream APINotesWriter (PR #65187)
Egor Zhdan via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 4 04:19:06 PDT 2023
================
@@ -1200,5 +1235,128 @@ APINotesWriter::~APINotesWriter() = default;
void APINotesWriter::writeToStream(llvm::raw_ostream &OS) {
Implementation->writeToStream(OS);
}
+
+ContextID APINotesWriter::addObjCContext(std::optional<ContextID> ParentCtxID,
+ StringRef Name, ContextKind Kind,
+ const ObjCContextInfo &Info,
+ VersionTuple SwiftVersion) {
+ IdentifierID NameID = Implementation->getIdentifier(Name);
+
+ uint32_t RawParentCtxID = ParentCtxID ? ParentCtxID->Value : -1;
+ ContextTableKey Key(RawParentCtxID, (uint8_t)Kind, NameID);
+ auto Known = Implementation->ObjCContexts.find(Key);
+ if (Known == Implementation->ObjCContexts.end()) {
+ unsigned NextID = Implementation->ObjCContexts.size() + 1;
+
+ VersionedSmallVector<ObjCContextInfo> EmptyVersionedInfo;
+ Known = Implementation->ObjCContexts
+ .insert(std::make_pair(
+ Key, std::make_pair(NextID, EmptyVersionedInfo)))
+ .first;
----------------
egorzhdan wrote:
Yeah, sometimes the formatting just looks weird
https://github.com/llvm/llvm-project/pull/65187
More information about the cfe-commits
mailing list