[clang] [FMV] Allow fmv without default declaration. (PR #85454)

via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 19 10:43:35 PDT 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 8c4546f350fbce938d8fbc85d9e353d011f3f673 ec2af3b7f5936cc452251cd61a396329457038d3 -- clang/lib/CodeGen/CodeGenModule.cpp clang/lib/CodeGen/CodeGenModule.h clang/lib/Sema/SemaDecl.cpp clang/lib/Sema/SemaOverload.cpp clang/test/CodeGen/attr-target-version.c clang/test/CodeGenCXX/attr-target-version.cpp clang/test/Sema/aarch64-sme-func-attrs.c clang/test/Sema/attr-target-version.c clang/test/SemaCXX/attr-target-version.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 420eeacd35..2156dd8c46 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -4096,9 +4096,9 @@ static FunctionDecl *createDefaultTargetVersionFrom(const FunctionDecl *FD) {
   StorageClass SC = FD->getStorageClass();
   DeclarationName Name = FD->getNameInfo().getName();
 
-  FunctionDecl *NewDecl = FunctionDecl::Create(
-      FD->getASTContext(), DeclCtx, FD->getBeginLoc(), FD->getEndLoc(), Name,
-      TInfo->getType(), TInfo, SC);
+  FunctionDecl *NewDecl =
+      FunctionDecl::Create(FD->getASTContext(), DeclCtx, FD->getBeginLoc(),
+                           FD->getEndLoc(), Name, TInfo->getType(), TInfo, SC);
 
   NewDecl->setIsMultiVersion();
   NewDecl->addAttr(TargetVersionAttr::CreateImplicit(
@@ -4123,8 +4123,7 @@ void CodeGenModule::emitMultiVersionFunctions() {
           EmitGlobalFunctionDefinition(CurGD, nullptr);
           Func = GetGlobalValue(MangledName);
         } else {
-          const CGFunctionInfo &FI =
-              getTypes().arrangeGlobalDeclaration(CurGD);
+          const CGFunctionInfo &FI = getTypes().arrangeGlobalDeclaration(CurGD);
           llvm::FunctionType *Ty = getTypes().GetFunctionType(FI);
           Func = GetAddrOfFunction(CurGD, Ty, /*ForVTable=*/false,
                                    /*DontDefer=*/false, ForDefinition);
@@ -4149,7 +4148,7 @@ void CodeGenModule::emitMultiVersionFunctions() {
                                    TA->getArchitecture(), Feats);
             } else if (const auto *TVA = CurFD->getAttr<TargetVersionAttr>()) {
               bool HasDefaultDef = TVA->isDefaultVersion() &&
-                  CurFD->doesThisDeclarationHaveABody();
+                                   CurFD->doesThisDeclarationHaveABody();
               HasDefaultDecl |= TVA->isDefaultVersion();
               ShouldEmitResolver |= (CurFD->isUsed() || HasDefaultDef);
               TVA->getFeatures(Feats);

``````````

</details>


https://github.com/llvm/llvm-project/pull/85454


More information about the cfe-commits mailing list