[all-commits] [llvm/llvm-project] a70919: [APINotes] Add support for capturing all possible ...

Artem Chikin via All-commits all-commits at lists.llvm.org
Thu Jul 10 11:19:40 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a7091951f0bbdeb78a76f933394a7754c5990371
      https://github.com/llvm/llvm-project/commit/a7091951f0bbdeb78a76f933394a7754c5990371
  Author: Artem Chikin <achikin at apple.com>
  Date:   2025-07-10 (Thu, 10 Jul 2025)

  Changed paths:
    M clang/include/clang/APINotes/APINotesManager.h
    M clang/include/clang/Basic/Attr.td
    M clang/include/clang/Basic/LangOptions.def
    M clang/include/clang/Driver/Options.td
    M clang/include/clang/Sema/Sema.h
    M clang/lib/APINotes/APINotesManager.cpp
    M clang/lib/Driver/ToolChains/Clang.cpp
    M clang/lib/Sema/SemaAPINotes.cpp
    A clang/test/APINotes/versioned-version-independent.m

  Log Message:
  -----------
  [APINotes] Add support for capturing all possible versioned APINotes without applying them

Swift-versioned API notes get applied at PCM constrution time relying on
'-fapinotes-swift-version=X' argument to pick the appropriate version.
This change adds a new APINotes application mode with
'-fswift-version-independent-apinotes' which causes *all* versioned API
notes to get recorded into the PCM wrapped in 'SwiftVersionedAttr'
instances. The expectation in this mode is that the Swift client will
perform the required transformations as per the API notes on the client
side, when loading the PCM, instead of them getting applied on the
producer side. This will allow the same PCM to be usable by Swift
clients building with different language versions.

In addition to versioned-wrapping the various existing API notes
annotations which are carried in declaration attributes, this change
adds a new attribute for two annotations which were previously applied
directly to the declaration at the PCM producer side: 1) Type and 2)
Nullability annotations with 'SwiftTypeAttr' and 'SwiftNullabilityAttr',
respectively. The logic to apply these two annotations to a declaration
is refactored into API.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list