[clang] [clang] Add add attribute [[clang::builtin]] (PR #78071)
via cfe-commits
cfe-commits at lists.llvm.org
Sat Jan 13 14:58:08 PST 2024
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 54e2749609d7114f4a48f4146cddeecf76d935a4 f073a827ddbe728ced53a82431f517da58753776 -- clang/test/CodeGenCXX/attr-builtin.cpp clang/test/SemaCXX/attr-builtin-debug.cpp clang/test/SemaCXX/attr-builtin.cpp clang/lib/AST/Decl.cpp clang/lib/AST/ExprConstant.cpp clang/lib/CodeGen/CGExpr.cpp clang/lib/Headers/mmintrin.h clang/lib/Sema/SemaDecl.cpp clang/lib/Sema/SemaDeclAttr.cpp clang/lib/Sema/SemaExpr.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index 52b45ba038..22201eca47 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -7665,11 +7665,11 @@ protected:
if (BuiltinOp == 0 || !Info.Ctx.BuiltinInfo.isConstantEvaluated(BuiltinOp))
return false;
- if (const auto* CD = E->getCalleeDecl()) {
- if (const auto* FD = CD->getAsFunction()) {
+ if (const auto *CD = E->getCalleeDecl()) {
+ if (const auto *FD = CD->getAsFunction()) {
if (FD->isConstexpr())
return true;
- if (const auto* BA = FD->getAttr<BuiltinAttr>())
+ if (const auto *BA = FD->getAttr<BuiltinAttr>())
return BA->isImplicit();
}
}
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp
index 3df09d8365..67f1c8114e 100644
--- a/clang/lib/Sema/SemaDeclAttr.cpp
+++ b/clang/lib/Sema/SemaDeclAttr.cpp
@@ -5921,8 +5921,7 @@ static void handleBuiltinAliasAttr(Sema &S, Decl *D,
D->addAttr(::new (S.Context) BuiltinAliasAttr(S.Context, AL, Ident));
}
-static void handleBuiltinAttr(Sema &S, Decl *D,
- const ParsedAttr &AL) {
+static void handleBuiltinAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
if (!AL.checkExactlyNumArgs(S, 1))
return;
@@ -5935,7 +5934,7 @@ static void handleBuiltinAttr(Sema &S, Decl *D,
unsigned ID =
S.getPreprocessor().getIdentifierTable().get(BuiltinName).getBuiltinID();
- auto& BuiltinInfo = S.Context.BuiltinInfo;
+ auto &BuiltinInfo = S.Context.BuiltinInfo;
if (ID == 0 || BuiltinInfo.isInStdNamespace(ID) != IsInStdNamespace) {
S.Diag(AL.getLoc(), diag::err_unknown_builtin);
@@ -5984,7 +5983,7 @@ static void handleBuiltinAttr(Sema &S, Decl *D,
});
};
- if (const auto* MD = dyn_cast<CXXMethodDecl>(D)) {
+ if (const auto *MD = dyn_cast<CXXMethodDecl>(D)) {
if (!MD->isStatic()) {
S.Diag(AL.getLoc(), diag::warn_unsupported_on_member_function);
return;
``````````
</details>
https://github.com/llvm/llvm-project/pull/78071
More information about the cfe-commits
mailing list