[all-commits] [llvm/llvm-project] b2098d: [APINotes] Allow annotating a C++ type as non-copy...

Egor Zhdan via All-commits all-commits at lists.llvm.org
Fri Apr 26 11:30:31 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b2098db2485331e01503e1452a7a60cd8c031a3f
      https://github.com/llvm/llvm-project/commit/b2098db2485331e01503e1452a7a60cd8c031a3f
  Author: Egor Zhdan <e_zhdan at apple.com>
  Date:   2024-04-26 (Fri, 26 Apr 2024)

  Changed paths:
    M clang/include/clang/APINotes/Types.h
    M clang/lib/APINotes/APINotesFormat.h
    M clang/lib/APINotes/APINotesReader.cpp
    M clang/lib/APINotes/APINotesWriter.cpp
    M clang/lib/APINotes/APINotesYAMLCompiler.cpp
    M clang/lib/Sema/SemaAPINotes.cpp
    M clang/test/APINotes/Inputs/Headers/SwiftImportAs.apinotes
    M clang/test/APINotes/Inputs/Headers/SwiftImportAs.h
    M clang/test/APINotes/swift-import-as.cpp

  Log Message:
  -----------
  [APINotes] Allow annotating a C++ type as non-copyable in Swift

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 implicit copy constructor. The Swift compiler inserts implicit
copies of value types in some cases, which trigger compiler errors for
such types.

This adds a Clang API Notes attribute that allows annotating C++ types
as non-copyable in Swift. This lets the Swift compiler know that it
should not try to instantiate the implicit copy constructor for a C++
struct.

rdar://127049438



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