================ @@ -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 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits