Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[clang] Add attribute [[clang::builtin]] #78071

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

philnik777
Copy link
Contributor

No description provided.

Copy link

⚠️ C/C++ code formatter, clang-format found issues in your code. ⚠️

You can test this locally with the following command:
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
View the diff from clang-format here.
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;

@philnik777 philnik777 changed the title [clang] Add add attribute [[clang::builtin]] [clang] Add attribute [[clang::builtin]] Jan 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant