[clang] [APINotes] Upstream Sema logic to apply API Notes to decls (PR #73017)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 21 09:03:39 PST 2023
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 2fe24fdc94cb10795a196eadcf3eed8055ea4000 b3b1a6c3c6774bc4158d7e273abcfbac5b5db02d -- clang/lib/Sema/SemaAPINotes.cpp clang/include/clang/Lex/Lexer.h clang/include/clang/Parse/Parser.h clang/include/clang/Sema/Sema.h clang/lib/Parse/ParseDecl.cpp clang/lib/Parse/Parser.cpp clang/lib/Sema/SemaDecl.cpp clang/lib/Sema/SemaDeclAttr.cpp clang/lib/Sema/SemaDeclCXX.cpp clang/lib/Sema/SemaDeclObjC.cpp clang/lib/Sema/SemaObjCProperty.cpp clang/lib/Sema/SemaTemplate.cpp clang/lib/Sema/SemaType.cpp clang/lib/Serialization/ASTReaderDecl.cpp clang/utils/TableGen/ClangAttrEmitter.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/lib/Sema/SemaObjCProperty.cpp b/clang/lib/Sema/SemaObjCProperty.cpp
index a7f99ba1ad..09b6a9cdfb 100644
--- a/clang/lib/Sema/SemaObjCProperty.cpp
+++ b/clang/lib/Sema/SemaObjCProperty.cpp
@@ -2580,7 +2580,7 @@ void Sema::ProcessPropertyDecl(ObjCPropertyDecl *property) {
if (const SectionAttr *SA = property->getAttr<SectionAttr>())
SetterMethod->addAttr(SectionAttr::CreateImplicit(
Context, SA->getName(), Loc, SectionAttr::GNU_section));
-
+
ProcessAPINotes(SetterMethod);
// It's possible for the user to have set a very odd custom
diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp
index aee5ea901a..1533eeb509 100644
--- a/clang/lib/Sema/SemaType.cpp
+++ b/clang/lib/Sema/SemaType.cpp
@@ -7578,8 +7578,8 @@ static bool CheckNullabilityTypeSpecifier(
break;
S.Diag(NullabilityLoc, diag::warn_nullability_duplicate)
- << DiagNullabilityKind(Nullability, IsContextSensitive)
- << FixItHint::CreateRemoval(NullabilityLoc);
+ << DiagNullabilityKind(Nullability, IsContextSensitive)
+ << FixItHint::CreateRemoval(NullabilityLoc);
break;
}
@@ -7587,8 +7587,8 @@ static bool CheckNullabilityTypeSpecifier(
if (!OverrideExisting) {
// Conflicting nullability.
S.Diag(NullabilityLoc, diag::err_nullability_conflicting)
- << DiagNullabilityKind(Nullability, IsContextSensitive)
- << DiagNullabilityKind(*ExistingNullability, false);
+ << DiagNullabilityKind(Nullability, IsContextSensitive)
+ << DiagNullabilityKind(*ExistingNullability, false);
return true;
}
@@ -7606,8 +7606,8 @@ static bool CheckNullabilityTypeSpecifier(
if (auto ExistingNullability = Desugared->getNullability()) {
if (Nullability != *ExistingNullability && !Implicit) {
S.Diag(NullabilityLoc, diag::err_nullability_conflicting)
- << DiagNullabilityKind(Nullability, IsContextSensitive)
- << DiagNullabilityKind(*ExistingNullability, false);
+ << DiagNullabilityKind(Nullability, IsContextSensitive)
+ << DiagNullabilityKind(*ExistingNullability, false);
// Try to find the typedef with the existing nullability specifier.
if (auto TT = Desugared->getAs<TypedefType>()) {
@@ -7617,7 +7617,7 @@ static bool CheckNullabilityTypeSpecifier(
AttributedType::stripOuterNullability(underlyingType)) {
if (*typedefNullability == *ExistingNullability) {
S.Diag(typedefDecl->getLocation(), diag::note_nullability_here)
- << DiagNullabilityKind(*ExistingNullability, false);
+ << DiagNullabilityKind(*ExistingNullability, false);
}
}
}
@@ -7631,7 +7631,7 @@ static bool CheckNullabilityTypeSpecifier(
!(AllowOnArrayType && Desugared->isArrayType())) {
if (!Implicit)
S.Diag(NullabilityLoc, diag::err_nullability_nonpointer)
- << DiagNullabilityKind(Nullability, IsContextSensitive) << QT;
+ << DiagNullabilityKind(Nullability, IsContextSensitive) << QT;
return true;
}
@@ -7650,11 +7650,11 @@ static bool CheckNullabilityTypeSpecifier(
pointeeType->isObjCObjectPointerType() ||
pointeeType->isMemberPointerType())) {
S.Diag(NullabilityLoc, diag::err_nullability_cs_multilevel)
- << DiagNullabilityKind(Nullability, true) << QT;
+ << DiagNullabilityKind(Nullability, true) << QT;
S.Diag(NullabilityLoc, diag::note_nullability_type_specifier)
- << DiagNullabilityKind(Nullability, false) << QT
- << FixItHint::CreateReplacement(NullabilityLoc,
- getNullabilitySpelling(Nullability));
+ << DiagNullabilityKind(Nullability, false) << QT
+ << FixItHint::CreateReplacement(NullabilityLoc,
+ getNullabilitySpelling(Nullability));
return true;
}
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/73017
More information about the cfe-commits
mailing list