[clang] [APINotes] Avoid duplicated attributes for class template instantiations (PR #122516)

2025-01-15 Thread Egor Zhdan via cfe-commits
https://github.com/egorzhdan closed https://github.com/llvm/llvm-project/pull/122516 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [APINotes] Avoid duplicated attributes for class template instantiations (PR #122516)

2025-01-15 Thread Egor Zhdan via cfe-commits
@@ -19493,7 +19493,11 @@ void Sema::ActOnFields(Scope *S, SourceLocation RecLoc, Decl *EnclosingDecl, CDecl->setIvarRBraceLoc(RBrac); } } - ProcessAPINotes(Record); + + // If this is a class template instantiation, its API Notes attributes were + // added to the

[clang] [APINotes] Avoid duplicated attributes for class template instantiations (PR #122516)

2025-01-15 Thread Egor Zhdan via cfe-commits
https://github.com/egorzhdan edited https://github.com/llvm/llvm-project/pull/122516 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [APINotes] Avoid duplicated attributes for class template instantiations (PR #122516)

2025-01-15 Thread Egor Zhdan via cfe-commits
https://github.com/egorzhdan updated https://github.com/llvm/llvm-project/pull/122516 >From 689b28a653eeed50a04a2fbd9286831ddfa1018b Mon Sep 17 00:00:00 2001 From: Egor Zhdan Date: Fri, 10 Jan 2025 19:41:02 + Subject: [PATCH] [APINotes] Avoid duplicated attributes for class template instan

[clang] [APINotes] Add SWIFT_RETURNS_(UN)RETAINED support (PR #118938)

2024-12-06 Thread Egor Zhdan via cfe-commits
https://github.com/egorzhdan approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/118938 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [APINotes] Add SWIFT_RETURNS_(UN)RETAINED support (PR #118938)

2024-12-06 Thread Egor Zhdan via cfe-commits
@@ -600,6 +603,15 @@ class FunctionInfo : public CommonEntityInfo { friend bool operator==(const FunctionInfo &, const FunctionInfo &); + FunctionInfo &operator|=(const FunctionInfo &RHS) { egorzhdan wrote: Are we using this function somewhere? I can't se

[clang] [APINotes] Add SWIFT_RETURNS_(UN)RETAINED support (PR #118938)

2024-12-06 Thread Egor Zhdan via cfe-commits
@@ -24,7 +24,7 @@ const uint16_t VERSION_MAJOR = 0; /// API notes file minor version number. /// /// When the format changes IN ANY WAY, this number should be incremented. -const uint16_t VERSION_MINOR = 33; // SwiftEscapable +const uint16_t VERSION_MINOR = 34; // SwiftEscapabl

[clang] [APINotes] Add SWIFT_RETURNS_(UN)RETAINED support (PR #118938)

2024-12-06 Thread Egor Zhdan via cfe-commits
https://github.com/egorzhdan commented: Please remember to increment the APINotes serialization version since the format is changing in this patch. https://github.com/llvm/llvm-project/pull/118938 ___ cfe-commits mailing list cfe-commits@lists.llvm.or

[clang] [APINotes] Add SWIFT_RETURNS_(UN)RETAINED support (PR #118938)

2024-12-06 Thread Egor Zhdan via cfe-commits
@@ -36,3 +42,29 @@ // CHECK-ESCAPABLE: Dumping EscapableType: // CHECK-ESCAPABLE-NEXT: CXXRecordDecl {{.+}} imported in SwiftImportAs {{.+}} struct EscapableType // CHECK-ESCAPABLE: SwiftAttrAttr {{.+}} "Escapable" + +//CHECK-FUNCTION-RETURNING-FRT: Dumping functionReturningFr

[clang] [APINotes] Add SWIFT_RETURNS_(UN)RETAINED support (PR #118938)

2024-12-06 Thread Egor Zhdan via cfe-commits
https://github.com/egorzhdan edited https://github.com/llvm/llvm-project/pull/118938 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [APINotes] Add SWIFT_RETURNS_(UN)RETAINED support (PR #118938)

2024-12-06 Thread Egor Zhdan via cfe-commits
https://github.com/egorzhdan edited https://github.com/llvm/llvm-project/pull/118938 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [APINotes] Add SWIFT_RETURNS_(UN)RETAINED support to APINotes (PR #118938)

2024-12-06 Thread Egor Zhdan via cfe-commits
@@ -3,6 +3,12 @@ Name: SwiftImportAs Tags: - Name: ImmortalRefType SwiftImportAs: reference + Methods: +- Name: methodReturningFrt__ +- Name: methodReturningFrt_returns_unretained + SwiftReturnOwnership: 'returns_unretained' +- Name: methodReturningFrt_retur

[clang] [APINotes] Add SWIFT_RETURNS_(UN)RETAINED support to APINotes (PR #118938)

2024-12-06 Thread Egor Zhdan via cfe-commits
@@ -511,6 +511,10 @@ static void ProcessAPINotes(Sema &S, FunctionOrMethod AnyFunc, AnyTypeChanged = true; } + // returns_(un)retained + if (!Info.SwiftReturnOwnership.empty()) +D->addAttr(SwiftAttrAttr::Create(S.Context, Info.SwiftReturnOwnership)); ---

[clang] [APINotes] Add SWIFT_RETURNS_(UN)RETAINED support to APINotes (PR #118938)

2024-12-06 Thread Egor Zhdan via cfe-commits
@@ -3,6 +3,12 @@ Name: SwiftImportAs Tags: - Name: ImmortalRefType SwiftImportAs: reference + Methods: +- Name: methodReturningFrt__ +- Name: methodReturningFrt_returns_unretained + SwiftReturnOwnership: 'returns_unretained' +- Name: methodReturningFrt_retur

[clang] [APINotes] Add SWIFT_RETURNS_(UN)RETAINED support to APINotes (PR #118938)

2024-12-06 Thread Egor Zhdan via cfe-commits
@@ -600,6 +603,13 @@ class FunctionInfo : public CommonEntityInfo { friend bool operator==(const FunctionInfo &, const FunctionInfo &); + FunctionInfo &operator|=(const FunctionInfo &RHS) { egorzhdan wrote: This function needs to invoke the overload from

[clang] [APINotes] Add SWIFT_RETURNS_(UN)RETAINED support to APINotes (PR #118938)

2024-12-06 Thread Egor Zhdan via cfe-commits
@@ -542,6 +542,9 @@ class FunctionInfo : public CommonEntityInfo { /// The result type of this function, as a C type. std::string ResultType; + /// Swift name of this entity. + std::string SwiftReturnOwnership; egorzhdan wrote: I think it's fine to repr

[clang] [clang][APINotes] Do not add duplicate lifetimebound annotation (PR #117194)

2024-11-21 Thread Egor Zhdan via cfe-commits
https://github.com/egorzhdan approved this pull request. LGTM! https://github.com/llvm/llvm-project/pull/117194 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Permit lifetimebound in all language modes (PR #115482)

2024-11-08 Thread Egor Zhdan via cfe-commits
https://github.com/egorzhdan approved this pull request. This seems totally reasonable. https://github.com/llvm/llvm-project/pull/115482 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Dispatch default overloads of `TemplateArgumentVisitor` to the implementation (PR #115336)

2024-11-07 Thread Egor Zhdan via cfe-commits
https://github.com/egorzhdan edited https://github.com/llvm/llvm-project/pull/115336 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Dispatch default overloads of `TemplateArgumentVisitor` to the implementation (PR #115336)

2024-11-07 Thread Egor Zhdan via cfe-commits
https://github.com/egorzhdan created https://github.com/llvm/llvm-project/pull/115336 This fixes an issue where overriding `clang::ConstTemplateArgumentVisitor::VisitTemplateArgument` in an implementation visitor class did not have the desired effect: the overload was not invoked when one of

[clang] Nominate Saleem and myself as maintainers for API Notes (PR #114981)

2024-11-05 Thread Egor Zhdan via cfe-commits
@@ -132,6 +132,14 @@ Compiler options | jan_svoboda\@apple.com (email), jansvoboda11 (Phabricator), jansvoboda11 (GitHub) +API Notes + +| Egor Zhdan +| e_zhdan\@apple.com (email), egorzhdan (GitHub), egor.zhdan (Discourse) + +| Saleem Abdulrasool +| compnerd\

[clang] Nominate Saleem and myself as maintainers for API Notes (PR #114981)

2024-11-05 Thread Egor Zhdan via cfe-commits
https://github.com/egorzhdan updated https://github.com/llvm/llvm-project/pull/114981 >From 1bf3932e901177518632eeaa05b21a05f3d43880 Mon Sep 17 00:00:00 2001 From: Egor Zhdan Date: Mon, 4 Nov 2024 19:52:37 + Subject: [PATCH 1/2] Nominate Saleem and myself as maintainers for API Notes ---

[clang] Nominate Saleem and myself as maintainers for API Notes (PR #114981)

2024-11-05 Thread Egor Zhdan via cfe-commits
https://github.com/egorzhdan updated https://github.com/llvm/llvm-project/pull/114981 >From 1bf3932e901177518632eeaa05b21a05f3d43880 Mon Sep 17 00:00:00 2001 From: Egor Zhdan Date: Mon, 4 Nov 2024 19:52:37 + Subject: [PATCH] Nominate Saleem and myself as maintainers for API Notes --- clan

[clang] Nominate Saleem and myself as maintainers for API Notes (PR #114981)

2024-11-05 Thread Egor Zhdan via cfe-commits
https://github.com/egorzhdan created https://github.com/llvm/llvm-project/pull/114981 Saleem has upstreamed a large chunk of API Notes infrastructure from the Apple fork, and over the past year I've upstreamed the remaining part of API Notes, added new annotations and improved C++ language sup

[clang] Add preliminary lifetimebound support to APINotes (PR #114830)

2024-11-04 Thread Egor Zhdan via cfe-commits
https://github.com/egorzhdan approved this pull request. LGTM, thanks! https://github.com/llvm/llvm-project/pull/114830 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [APINotes] Document immortal reference type annotation (PR #114042)

2024-11-04 Thread Egor Zhdan via cfe-commits
https://github.com/egorzhdan closed https://github.com/llvm/llvm-project/pull/114042 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [APINotes] Document immortal reference type annotation (PR #114042)

2024-10-29 Thread Egor Zhdan via cfe-commits
https://github.com/egorzhdan created https://github.com/llvm/llvm-project/pull/114042 API Notes allow annotating a C++ reference type with its retain/release operations. These are honored by the Swift compiler when the type is used from Swift. Apart from names of C++ functions that need to be

[clang] Allow tag-based API notes on anonymous tag decls with typedef names (PR #110768)

2024-10-02 Thread Egor Zhdan via cfe-commits
https://github.com/egorzhdan closed https://github.com/llvm/llvm-project/pull/110768 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Allow tag-based API notes on anonymous tag decls with typedef names (PR #110768)

2024-10-02 Thread Egor Zhdan via cfe-commits
https://github.com/egorzhdan approved this pull request. https://github.com/llvm/llvm-project/pull/110768 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [APINotes] Avoid repeated hash lookups (NFC) (PR #107959)

2024-09-10 Thread Egor Zhdan via cfe-commits
https://github.com/egorzhdan approved this pull request. LGTM! https://github.com/llvm/llvm-project/pull/107959 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [APINotes] Support fields of C/C++ structs (PR #104088)

2024-08-16 Thread Egor Zhdan via cfe-commits
https://github.com/egorzhdan closed https://github.com/llvm/llvm-project/pull/104088 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [APINotes] Support fields of C/C++ structs (PR #104088)

2024-08-14 Thread Egor Zhdan via cfe-commits
@@ -793,6 +827,16 @@ class YAMLConverter { SwiftVersion); } + template + void convertVariable(const T &Entity, VariableInfo &VI) { egorzhdan wrote: The existing methods that do the same thing for classes, methods, etc. are calle

[clang] [APINotes] Support fields of C/C++ structs (PR #104088)

2024-08-14 Thread Egor Zhdan via cfe-commits
@@ -858,6 +867,62 @@ void APINotesWriter::Implementation::writeCXXMethodBlock( } } +namespace { +/// Used to serialize the on-disk C field table. +class FieldTableInfo +: public VersionedTableInfo { +public: + unsigned getKeyLength(key_type_ref) { +return sizeof(ui

[clang] [APINotes] Support fields of C/C++ structs (PR #104088)

2024-08-14 Thread Egor Zhdan via cfe-commits
@@ -1252,6 +1282,81 @@ bool APINotesReader::Implementation::readCXXMethodBlock( return false; } +bool APINotesReader::Implementation::readFieldBlock( +llvm::BitstreamCursor &Cursor, llvm::SmallVectorImpl &Scratch) { + if (Cursor.EnterSubBlock(FIELD_BLOCK_ID)) +retur

[clang] [APINotes] Support fields of C/C++ structs (PR #104088)

2024-08-14 Thread Egor Zhdan via cfe-commits
https://github.com/egorzhdan updated https://github.com/llvm/llvm-project/pull/104088 >From 1f41cef4dfbf19517c67586945ad9885f48a7150 Mon Sep 17 00:00:00 2001 From: Egor Zhdan Date: Wed, 14 Aug 2024 18:37:25 +0100 Subject: [PATCH] [APINotes] Support fields of C/C++ structs This allows annotatin

[clang] [APINotes] Support fields of C/C++ structs (PR #104088)

2024-08-14 Thread Egor Zhdan via cfe-commits
https://github.com/egorzhdan updated https://github.com/llvm/llvm-project/pull/104088 >From 3e4c23b5cdfba147bf6598822ca4d9174c984a05 Mon Sep 17 00:00:00 2001 From: Egor Zhdan Date: Wed, 14 Aug 2024 18:37:25 +0100 Subject: [PATCH] [APINotes] Support fields of C/C++ structs This allows annotatin

[clang] [APINotes] Support fields of C/C++ structs (PR #104088)

2024-08-14 Thread Egor Zhdan via cfe-commits
https://github.com/egorzhdan created https://github.com/llvm/llvm-project/pull/104088 This allows annotating fields of C/C++ structs using API Notes. Previously API Notes supported Objective-C properties, but not fields. rdar://131548377 >From cefe51c59177d4c69a1d556408e6a69301c07326 Mon Sep

[clang] [APINotes] Support C++ tag conformances to Swift protocols (PR #102664)

2024-08-13 Thread Egor Zhdan via cfe-commits
https://github.com/egorzhdan closed https://github.com/llvm/llvm-project/pull/102664 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [APINotes] Support C++ tag conformances to Swift protocols (PR #102664)

2024-08-12 Thread Egor Zhdan via cfe-commits
@@ -1230,6 +1231,12 @@ class TagTableInfo : public CommonTypeTableInfo { } else { writer.write(0); } +if (auto ConformsTo = TI.SwiftConformsTo) { + writer.write(ConformsTo->size() + 1); + OS.write(ConformsTo->c_str(), ConformsTo->size()); --

[clang] [APINotes] Support C++ tag conformances to Swift protocols (PR #102664)

2024-08-12 Thread Egor Zhdan via cfe-commits
@@ -572,6 +572,13 @@ class TagTableInfo ReleaseOpLength - 1); Data += ReleaseOpLength - 1; } +unsigned ConformsToLength = +endian::readNext(Data); +if (ConformsToLength > 0) { egorzhdan wrote: D

[clang] [APINotes] Support C++ tag conformances to Swift protocols (PR #102664)

2024-08-12 Thread Egor Zhdan via cfe-commits
https://github.com/egorzhdan updated https://github.com/llvm/llvm-project/pull/102664 >From 4735b4c7bad13dee4bbeb819aba8ac555f842322 Mon Sep 17 00:00:00 2001 From: Egor Zhdan Date: Fri, 9 Aug 2024 20:08:43 +0100 Subject: [PATCH] [APINotes] Support C++ tag conformances to Swift protocols This a

[clang] [APINotes] Support C++ tag conformances to Swift protocols (PR #102664)

2024-08-09 Thread Egor Zhdan via cfe-commits
https://github.com/egorzhdan created https://github.com/llvm/llvm-project/pull/102664 This allows adding a Clang attribute `swift_attr("conforms_to:ModuleName.ProtocolName")` to C++ structs via API Notes. The Swift compiler respects this attribute when importing C++ types into Swift by autom

[clang] [APINotes] Do not crash for C++ operators (PR #101001)

2024-07-29 Thread Egor Zhdan via cfe-commits
https://github.com/egorzhdan closed https://github.com/llvm/llvm-project/pull/101001 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [APINotes] Do not crash for C++ operators (PR #101001)

2024-07-29 Thread Egor Zhdan via cfe-commits
@@ -1044,11 +1044,13 @@ void Sema::ProcessAPINotes(Decl *D) { if (auto TagContext = dyn_cast(D->getDeclContext())) { if (auto CXXMethod = dyn_cast(D)) { - for (auto Reader : APINotes.findAPINotes(D->getLocation())) { -if (auto Context = UnwindTagContext(TagC

[clang] [APINotes] Do not crash for C++ operators (PR #101001)

2024-07-29 Thread Egor Zhdan via cfe-commits
https://github.com/egorzhdan updated https://github.com/llvm/llvm-project/pull/101001 >From 63e76d8e6576f651b7a2aa6358444e82e8a1b662 Mon Sep 17 00:00:00 2001 From: Egor Zhdan Date: Mon, 29 Jul 2024 13:01:18 +0100 Subject: [PATCH] [APINotes] Do not crash for C++ operators This fixes a crash dur

[clang] [APINotes] Do not crash for C++ operators (PR #101001)

2024-07-29 Thread Egor Zhdan via cfe-commits
@@ -1044,11 +1044,13 @@ void Sema::ProcessAPINotes(Decl *D) { if (auto TagContext = dyn_cast(D->getDeclContext())) { if (auto CXXMethod = dyn_cast(D)) { - for (auto Reader : APINotes.findAPINotes(D->getLocation())) { -if (auto Context = UnwindTagContext(TagC

[clang] [APINotes] Do not crash for C++ operators (PR #101001)

2024-07-29 Thread Egor Zhdan via cfe-commits
@@ -1044,11 +1044,13 @@ void Sema::ProcessAPINotes(Decl *D) { if (auto TagContext = dyn_cast(D->getDeclContext())) { if (auto CXXMethod = dyn_cast(D)) { - for (auto Reader : APINotes.findAPINotes(D->getLocation())) { -if (auto Context = UnwindTagContext(TagC

[clang] [APINotes] Do not crash for C++ operators (PR #101001)

2024-07-29 Thread Egor Zhdan via cfe-commits
https://github.com/egorzhdan created https://github.com/llvm/llvm-project/pull/101001 This fixes a crash during `CXXMethod->getName()` in `Sema::ProcessAPINotes`: we were trying to get the name of a C++ method as a string, which fails with an assertion if the name is not a simple identifier.

[clang] [APINotes] Support nested tags (PR #99655)

2024-07-22 Thread Egor Zhdan via cfe-commits
@@ -783,51 +783,76 @@ static void ProcessVersionedAPINotes( } } +static std::optional +UnwindNamespaceContext(DeclContext *DC, api_notes::APINotesManager &APINotes) { + if (auto NamespaceContext = dyn_cast(DC)) { +for (auto Reader : APINotes.findAPINotes(NamespaceContex

[clang] [APINotes] Support nested tags (PR #99655)

2024-07-22 Thread Egor Zhdan via cfe-commits
@@ -456,6 +458,7 @@ template <> struct MappingTraits { IO.mapOptional("EnumKind", T.EnumConvenienceKind); IO.mapOptional("SwiftCopyable", T.SwiftCopyable); IO.mapOptional("Methods", T.Methods); +IO.mapOptional("Tags", T.Tags); egorzhdan wrote:

[clang] [APINotes] Support nested tags (PR #99655)

2024-07-22 Thread Egor Zhdan via cfe-commits
https://github.com/egorzhdan updated https://github.com/llvm/llvm-project/pull/99655 >From f1e3a236ca5dbc64913b0d44bdf92a30d38b8277 Mon Sep 17 00:00:00 2001 From: Egor Zhdan Date: Fri, 19 Jul 2024 15:24:10 +0100 Subject: [PATCH] [APINotes] Support nested tags This allows annotating C/C++ struc

[clang] [APINotes] Support nested tags (PR #99655)

2024-07-22 Thread Egor Zhdan via cfe-commits
@@ -783,51 +783,76 @@ static void ProcessVersionedAPINotes( } } +static std::optional +UnwindNamespaceContext(DeclContext *DC, api_notes::APINotesManager &APINotes) { + if (auto NamespaceContext = dyn_cast(DC)) { +for (auto Reader : APINotes.findAPINotes(NamespaceContex

[clang] [APINotes] Support nested tags (PR #99655)

2024-07-22 Thread Egor Zhdan via cfe-commits
@@ -456,6 +458,7 @@ template <> struct MappingTraits { IO.mapOptional("EnumKind", T.EnumConvenienceKind); IO.mapOptional("SwiftCopyable", T.SwiftCopyable); IO.mapOptional("Methods", T.Methods); +IO.mapOptional("Tags", T.Tags); egorzhdan wrote:

[clang] [APINotes] Support nested tags (PR #99655)

2024-07-19 Thread Egor Zhdan via cfe-commits
@@ -783,51 +783,76 @@ static void ProcessVersionedAPINotes( } } +static std::optional +UnwindNamespaceContext(DeclContext *DC, api_notes::APINotesManager &APINotes) { + if (auto NamespaceContext = dyn_cast(DC)) { +for (auto Reader : APINotes.findAPINotes(NamespaceContex

[clang] [APINotes] Support nested tags (PR #99655)

2024-07-19 Thread Egor Zhdan via cfe-commits
@@ -421,9 +424,8 @@ struct Tag { std::optional EnumConvenienceKind; std::optional SwiftCopyable; FunctionsSeq Methods; + TagsSeq Tags; egorzhdan wrote: These are, in fact, child tags – I can add a comment here describing the meaning of this field. htt

[clang] [APINotes] Support nested tags (PR #99655)

2024-07-19 Thread Egor Zhdan via cfe-commits
@@ -958,12 +961,18 @@ class YAMLConverter { ContextInfo CI; auto TagCtxID = Writer.addContext(ParentContextID, T.Name, ContextKind::Tag, CI, SwiftVersion); +Context TagCtx(TagCtxID, ContextKind::Tag); for (const auto &CX

[clang] [APINotes] Support nested tags (PR #99655)

2024-07-19 Thread Egor Zhdan via cfe-commits
@@ -899,6 +924,10 @@ void Sema::ProcessAPINotes(Decl *D) { } for (auto Reader : APINotes.findAPINotes(D->getLocation())) { +if (Tag->getName() == "inner_char_box") + llvm::errs(); egorzhdan wrote: My bad! Removed this. https://gi

[clang] [APINotes] Support nested tags (PR #99655)

2024-07-19 Thread Egor Zhdan via cfe-commits
https://github.com/egorzhdan updated https://github.com/llvm/llvm-project/pull/99655 >From 824de086ec1e3208fce111a3cfacc971dc032b60 Mon Sep 17 00:00:00 2001 From: Egor Zhdan Date: Fri, 19 Jul 2024 15:24:10 +0100 Subject: [PATCH] [APINotes] Support nested tags This allows annotating C/C++ struc

[clang] [APINotes] Support nested tags (PR #99655)

2024-07-19 Thread Egor Zhdan via cfe-commits
@@ -456,6 +458,7 @@ template <> struct MappingTraits { IO.mapOptional("EnumKind", T.EnumConvenienceKind); IO.mapOptional("SwiftCopyable", T.SwiftCopyable); IO.mapOptional("Methods", T.Methods); +IO.mapOptional("Tags", T.Tags); egorzhdan wrote:

[clang] [APINotes] Support nested tags (PR #99655)

2024-07-19 Thread Egor Zhdan via cfe-commits
https://github.com/egorzhdan created https://github.com/llvm/llvm-project/pull/99655 This allows annotating C/C++ structs declared within other structs using API Notes. rdar://132083354 >From 8ee14d729d996a9414438a64ecc789082c421bd0 Mon Sep 17 00:00:00 2001 From: Egor Zhdan Date: Fri, 19 Jul

[clang] [APINotes] Support annotating C++ methods (PR #99512)

2024-07-19 Thread Egor Zhdan via cfe-commits
https://github.com/egorzhdan closed https://github.com/llvm/llvm-project/pull/99512 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [APINotes] Support annotating C++ methods (PR #99512)

2024-07-18 Thread Egor Zhdan via cfe-commits
@@ -794,6 +831,33 @@ void APINotesWriter::Implementation::writeObjCMethodBlock( } } +void APINotesWriter::Implementation::writeCXXMethodBlock( +llvm::BitstreamWriter &Stream) { + llvm::BCBlockRAII Scope(Stream, CXX_METHOD_BLOCK_ID, 3); + + if (CXXMethods.empty()) +

[clang] [APINotes] Support annotating C++ methods (PR #99512)

2024-07-18 Thread Egor Zhdan via cfe-commits
https://github.com/egorzhdan updated https://github.com/llvm/llvm-project/pull/99512 >From 117596b16e143e44c2b6c17184840490490e16a7 Mon Sep 17 00:00:00 2001 From: Egor Zhdan Date: Thu, 18 Jul 2024 15:49:24 +0100 Subject: [PATCH] [APINotes] Support annotating C++ methods This adds support for a

[clang] [APINotes] Support annotating C++ methods (PR #99512)

2024-07-18 Thread Egor Zhdan via cfe-commits
https://github.com/egorzhdan updated https://github.com/llvm/llvm-project/pull/99512 >From 0a0dbf24c096c4fc0be973fb03bb48688afa447b Mon Sep 17 00:00:00 2001 From: Egor Zhdan Date: Thu, 18 Jul 2024 15:49:24 +0100 Subject: [PATCH] [APINotes] Support annotating C++ methods This adds support for a

[clang] [APINotes] Support annotating C++ methods (PR #99512)

2024-07-18 Thread Egor Zhdan via cfe-commits
https://github.com/egorzhdan created https://github.com/llvm/llvm-project/pull/99512 This adds support for adding Clang attributes to C++ methods declared within C++ records by using API Notes. For instance: ``` Tags: - Name: IntWrapper Methods: - Name: getIncremented Availability: non

[clang] [APINotes] Reduce memory footprint for Obj-C/C++ contexts (PR #99358)

2024-07-18 Thread Egor Zhdan via cfe-commits
https://github.com/egorzhdan closed https://github.com/llvm/llvm-project/pull/99358 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [APINotes] Reduce memory footprint for Obj-C/C++ contexts (PR #99358)

2024-07-17 Thread Egor Zhdan via cfe-commits
@@ -286,6 +280,31 @@ inline bool operator==(const ContextTableKey &lhs, const ContextTableKey &rhs) { lhs.contextKind == rhs.contextKind && lhs.contextID == rhs.contextID; } +/// A stored Objective-C or C++ declaration, represented by the ID of its parent +/// conte

[clang] [APINotes] Reduce memory footprint for Obj-C/C++ contexts (PR #99358)

2024-07-17 Thread Egor Zhdan via cfe-commits
egorzhdan wrote: Yeap, exactly, we weren't actually using the context kind, so this patch basically just removes it. https://github.com/llvm/llvm-project/pull/99358 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin

[clang] [APINotes] Reduce memory footprint for Obj-C/C++ contexts (PR #99358)

2024-07-17 Thread Egor Zhdan via cfe-commits
https://github.com/egorzhdan updated https://github.com/llvm/llvm-project/pull/99358 >From 8fcad7fee075e59dcf38716f19de738f51d85d82 Mon Sep 17 00:00:00 2001 From: Egor Zhdan Date: Wed, 17 Jul 2024 18:13:34 +0100 Subject: [PATCH] [APINotes] Reduce memory footprint for Obj-C/C++ contexts We were

[clang] [APINotes] Reduce memory footprint for Obj-C/C++ contexts (PR #99358)

2024-07-17 Thread Egor Zhdan via cfe-commits
@@ -269,12 +269,6 @@ struct ContextTableKey { : parentContextID(parentContextID), contextKind(contextKind), contextID(contextID) {} - ContextTableKey(std::optional context, IdentifierID nameID) - : parentContextID(context ? context->id.Value : (uint32_t)-1)

[clang] [APINotes] Reduce memory footprint for Obj-C/C++ contexts (PR #99358)

2024-07-17 Thread Egor Zhdan via cfe-commits
https://github.com/egorzhdan created https://github.com/llvm/llvm-project/pull/99358 We were storing extraneous data for certain Objective-C/C++ entities. Specifically, for declarations that can be nested in another context (such as functions) we were storing the kind of the parent context in

[clang] [APINotes] Remove unused API (PR #98943)

2024-07-16 Thread Egor Zhdan via cfe-commits
https://github.com/egorzhdan closed https://github.com/llvm/llvm-project/pull/98943 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [APINotes] Remove unused API (PR #98943)

2024-07-16 Thread Egor Zhdan via cfe-commits
egorzhdan wrote: Yeah, I can't see any usages of this in the past few years. It was probably used a long while ago. https://github.com/llvm/llvm-project/pull/98943 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/

[clang] [APINotes] Remove unused API (PR #98943)

2024-07-15 Thread Egor Zhdan via cfe-commits
https://github.com/egorzhdan created https://github.com/llvm/llvm-project/pull/98943 This method is not actually used anywhere. >From 4010859ca13a79d55a7b47f9363ee32870b7f1ef Mon Sep 17 00:00:00 2001 From: Egor Zhdan Date: Mon, 15 Jul 2024 19:37:13 +0100 Subject: [PATCH] [APINotes] Remove unus

[clang] [APINotes] Refactor: remove references to `ObjCContext...` (PR #98201)

2024-07-10 Thread Egor Zhdan via cfe-commits
https://github.com/egorzhdan closed https://github.com/llvm/llvm-project/pull/98201 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [APINotes] Refactor: remove references to `ObjCContext...` (PR #98201)

2024-07-09 Thread Egor Zhdan via cfe-commits
https://github.com/egorzhdan updated https://github.com/llvm/llvm-project/pull/98201 >From d90ff1e2ff914a6086fe06578594de7cfc11b2af Mon Sep 17 00:00:00 2001 From: Egor Zhdan Date: Tue, 9 Jul 2024 19:53:08 +0100 Subject: [PATCH] [APINotes] Refactor: remove references to `ObjCContext...` API Not

[clang] [APINotes] Refactor: remove references to `ObjCContext...` (PR #98201)

2024-07-09 Thread Egor Zhdan via cfe-commits
https://github.com/egorzhdan created https://github.com/llvm/llvm-project/pull/98201 API Notes now support in C++. In preparation for supporting C++ methods in API Notes, this change renames the remaining usages of `ObjCContextABC` into `ContextABC` to make it clear that those contexts might a

[clang] [APINotes] Update the documentation with new features (PR #95162)

2024-06-12 Thread Egor Zhdan via cfe-commits
https://github.com/egorzhdan closed https://github.com/llvm/llvm-project/pull/95162 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [APINotes] Update the documentation with new features (PR #95162)

2024-06-12 Thread Egor Zhdan via cfe-commits
egorzhdan wrote: The test failures are unrelated to this change. https://github.com/llvm/llvm-project/pull/95162 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [APINotes] Update the documentation with new features (PR #95162)

2024-06-11 Thread Egor Zhdan via cfe-commits
https://github.com/egorzhdan updated https://github.com/llvm/llvm-project/pull/95162 >From c9d9d115118471f0ca6a311e44b366ef9fe4fb2b Mon Sep 17 00:00:00 2001 From: Egor Zhdan Date: Tue, 11 Jun 2024 19:58:53 +0100 Subject: [PATCH 1/2] [APINotes] Update the documentation with new features This ad

[clang] [APINotes] Update the documentation with new features (PR #95162)

2024-06-11 Thread Egor Zhdan via cfe-commits
https://github.com/egorzhdan created https://github.com/llvm/llvm-project/pull/95162 This adds the documentation for a few recently added Clang API Notes features: C++ namespaces, `SwiftImportAs` and `SwiftCopyable`. >From c9d9d115118471f0ca6a311e44b366ef9fe4fb2b Mon Sep 17 00:00:00 2001 From:

[clang] [NFC] Add missing spaces in BoolOption for apinotes (PR #92027)

2024-05-13 Thread Egor Zhdan via cfe-commits
https://github.com/egorzhdan approved this pull request. Thank you, LGTM! https://github.com/llvm/llvm-project/pull/92027 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Add diagnostic about "%P" specifier with Objective-C pointers (PR #89977)

2024-04-29 Thread Egor Zhdan via cfe-commits
https://github.com/egorzhdan closed https://github.com/llvm/llvm-project/pull/89977 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Add diagnostic about "%P" specifier with Objective-C pointers (PR #89977)

2024-04-29 Thread Egor Zhdan via cfe-commits
https://github.com/egorzhdan edited https://github.com/llvm/llvm-project/pull/89977 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Add diagnostic about "%P" specifier with Objective-C pointers (#89968) (PR #89977)

2024-04-29 Thread Egor Zhdan via cfe-commits
https://github.com/egorzhdan edited https://github.com/llvm/llvm-project/pull/89977 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [APINotes] Allow annotating a C++ type as non-copyable in Swift (PR #90064)

2024-04-26 Thread Egor Zhdan via cfe-commits
https://github.com/egorzhdan closed https://github.com/llvm/llvm-project/pull/90064 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [APINotes] Allow annotating a C++ type as non-copyable in Swift (PR #90064)

2024-04-26 Thread Egor Zhdan via cfe-commits
egorzhdan wrote: The test failure on Windows is not related to this PR. https://github.com/llvm/llvm-project/pull/90064 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [APINotes] Allow annotating a C++ type as non-copyable in Swift (PR #90064)

2024-04-25 Thread Egor Zhdan via cfe-commits
https://github.com/egorzhdan updated https://github.com/llvm/llvm-project/pull/90064 >From 60191f2bc6cb191b5b256d220a8b1d07093bddd1 Mon Sep 17 00:00:00 2001 From: Egor Zhdan Date: Thu, 25 Apr 2024 15:19:09 +0100 Subject: [PATCH] [APINotes] Allow annotating a C++ type as non-copyable in Swift

[clang] [APINotes] Allow annotating a C++ type as non-copyable in Swift (PR #90064)

2024-04-25 Thread Egor Zhdan via cfe-commits
https://github.com/egorzhdan ready_for_review https://github.com/llvm/llvm-project/pull/90064 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [APINotes] Allow annotating a C++ type as non-copyable in Swift (PR #90064)

2024-04-25 Thread Egor Zhdan via cfe-commits
@@ -1146,6 +1146,12 @@ class TagTableInfo : public CommonTypeTableInfo { writer.write(Flags); +if (auto Copyable = TI.isSwiftCopyable()) { egorzhdan wrote: Fixed https://github.com/llvm/llvm-project/pull/90064 __

[clang] [APINotes] Allow annotating a C++ type as non-copyable in Swift (PR #90064)

2024-04-25 Thread Egor Zhdan via cfe-commits
@@ -527,6 +527,13 @@ class TagTableInfo Info.EnumExtensibility = static_cast((Payload & 0x3) - 1); +uint8_t Copyable = +endian::readNext(Data); +if (Copyable == 1) + Info.setSwiftCopyable(std::optional(false)); +else if (Copyable == 2)

[clang] [APINotes] Allow annotating a C++ type as non-copyable in Swift (PR #90064)

2024-04-25 Thread Egor Zhdan via cfe-commits
https://github.com/egorzhdan updated https://github.com/llvm/llvm-project/pull/90064 >From f0394cfaf4df3881809fdce7882bda3006951805 Mon Sep 17 00:00:00 2001 From: Egor Zhdan Date: Thu, 25 Apr 2024 15:19:09 +0100 Subject: [PATCH] [APINotes] Allow annotating a C++ type as non-copyable in Swift

[clang] [APINotes] Allow annotating a C++ type as non-copyable in Swift (PR #90064)

2024-04-25 Thread Egor Zhdan via cfe-commits
@@ -1125,10 +1125,10 @@ class CommonTypeTableInfo class TagTableInfo : public CommonTypeTableInfo { public: unsigned getUnversionedInfoSize(const TagInfo &TI) { -return 2 + (TI.SwiftImportAs ? TI.SwiftImportAs->size() : 0) + - 2 + (TI.SwiftRetainOp ? TI.SwiftRet

[clang] [APINotes] Allow annotating a C++ type as non-copyable in Swift (PR #90064)

2024-04-25 Thread Egor Zhdan via cfe-commits
https://github.com/egorzhdan updated https://github.com/llvm/llvm-project/pull/90064 >From 9eac3a34aa9c48e1ddc715ca04c4380f1d78a876 Mon Sep 17 00:00:00 2001 From: Egor Zhdan Date: Thu, 25 Apr 2024 15:19:09 +0100 Subject: [PATCH] [APINotes] Allow annotating a C++ type as non-copyable in Swift

[clang] [APINotes] Allow annotating a C++ type as non-copyable in Swift (PR #90064)

2024-04-25 Thread Egor Zhdan via cfe-commits
https://github.com/egorzhdan created https://github.com/llvm/llvm-project/pull/90064 Certain C++ types, such as `std::chrono::tzdb` in libstdc++, are non-copyable, but don't explicitly delete their copy constructor. Instead, they trigger template instantiation errors when trying to call their

[clang] [APINotes] Add test for C++ class templates (PR #87006)

2024-03-29 Thread Egor Zhdan via cfe-commits
https://github.com/egorzhdan closed https://github.com/llvm/llvm-project/pull/87006 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [APINotes] Add test for C++ class templates (PR #87006)

2024-03-28 Thread Egor Zhdan via cfe-commits
https://github.com/egorzhdan created https://github.com/llvm/llvm-project/pull/87006 This upstreams https://github.com/apple/llvm-project/pull/7930. This adds a test to verify that we can apply attributes to C++ class templates using API Notes. Doing the same for function templates is not curr

[clang] [APINotes] For a re-exported module, look for APINotes in the re-exporting module's apinotes file (PR #86820)

2024-03-28 Thread Egor Zhdan via cfe-commits
https://github.com/egorzhdan closed https://github.com/llvm/llvm-project/pull/86820 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [APINotes] For a re-exported module, look for APINotes in the re-exporting module's apinotes file (PR #86820)

2024-03-27 Thread Egor Zhdan via cfe-commits
https://github.com/egorzhdan created https://github.com/llvm/llvm-project/pull/86820 This upstreams https://github.com/apple/llvm-project/pull/8063. If module FooCore is re-exported through module Foo (by using `export_as` in the modulemap), look for attributes of FooCore symbols in Foo.apinot

[clang] [APINotes] Upstream the remaining API Notes fixes and tests (PR #84773)

2024-03-27 Thread Egor Zhdan via cfe-commits
https://github.com/egorzhdan closed https://github.com/llvm/llvm-project/pull/84773 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

  1   2   3   4   >