Skip to content

Commit dfc82b0

Browse files
committed
[APINotes] Upstream Sema logic to apply API Notes to decls
1 parent 99030d3 commit dfc82b0

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
@@ -10671,6 +10671,13 @@ def warn_imp_cast_drops_unaligned : Warning<
1067110671

1067210672
} // end of sema category
1067310673

10674+
let CategoryName = "API Notes Issue" in {
10675+
10676+
def err_incompatible_replacement_type : Error<
10677+
"API notes replacement type %0 has a different size from original type %1">;
10678+
10679+
} // end of API Notes category
10680+
1067410681
let CategoryName = "OpenMP Issue" in {
1067510682
// OpenMP support.
1067610683
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
@@ -4749,6 +4749,12 @@ class Sema final {
47494749
bool checkCommonAttributeFeatures(const Stmt *S, const ParsedAttr &A,
47504750
bool SkipArgCountCheck = false);
47514751

4752+
/// Map any API notes provided for this declaration to attributes on the
4753+
/// declaration.
4754+
///
4755+
/// Triggered by declaration-attribute processing.
4756+
void ProcessAPINotes(Decl *D);
4757+
47524758
/// Determine if type T is a valid subject for a nonnull and similar
47534759
/// attributes. By default, we look through references (the behavior used by
47544760
/// 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)