Skip to content

Commit 6fdb42e

Browse files
committed
[APINotes] Upstream Sema logic to apply API Notes to decls
This upstreams more of the Clang API Notes functionality that is currently implemented in the Apple fork: https://github.com/apple/llvm-project/tree/next/clang/lib/APINotes
1 parent 77d21e7 commit 6fdb42e

File tree

10 files changed

+1056
-1
lines changed

10 files changed

+1056
-1
lines changed

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10723,6 +10723,13 @@ def warn_imp_cast_drops_unaligned : Warning<
1072310723

1072410724
} // end of sema category
1072510725

10726+
let CategoryName = "API Notes Issue" in {
10727+
10728+
def err_incompatible_replacement_type : Error<
10729+
"API notes replacement type %0 has a different size from original type %1">;
10730+
10731+
} // end of API Notes category
10732+
1072610733
let CategoryName = "OpenMP Issue" in {
1072710734
// OpenMP support.
1072810735
def err_omp_expected_var_arg : Error<

clang/include/clang/Sema/Sema.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4763,6 +4763,12 @@ class Sema final {
47634763
bool checkCommonAttributeFeatures(const Stmt *S, const ParsedAttr &A,
47644764
bool SkipArgCountCheck = false);
47654765

4766+
/// Map any API notes provided for this declaration to attributes on the
4767+
/// declaration.
4768+
///
4769+
/// Triggered by declaration-attribute processing.
4770+
void ProcessAPINotes(Decl *D);
4771+
47664772
/// Determine if type T is a valid subject for a nonnull and similar
47674773
/// attributes. By default, we look through references (the behavior used by
47684774
/// nonnull), but if the second parameter is true, then we treat a reference

clang/lib/Sema/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ add_clang_library(clangSema
2727
Sema.cpp
2828
SemaAccess.cpp
2929
SemaAttr.cpp
30+
SemaAPINotes.cpp
3031
SemaAvailability.cpp
3132
SemaCXXScopeSpec.cpp
3233
SemaCast.cpp

0 commit comments

Comments
 (0)