[clang] [llvm] Reapply "[RISCV][clang] Support XSfmm ABI attributes (#206260)" (PR #241642)

via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 11 19:07:35 PST 2026


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 origin/main HEAD --extensions c,cpp,h -- clang/test/PCH/riscv-function-attributes.cpp clang/test/Sema/sifive-xsfmm-func-attr.c llvm/lib/Target/RISCV/RISCVStateAttributes.h clang/include/clang/AST/TypeBase.h clang/include/clang/Sema/SemaRISCV.h clang/lib/AST/ASTContext.cpp clang/lib/AST/Type.cpp clang/lib/AST/TypePrinter.cpp clang/lib/CodeGen/CGCall.cpp clang/lib/Sema/SemaChecking.cpp clang/lib/Sema/SemaRISCV.cpp clang/lib/Sema/SemaType.cpp llvm/lib/Target/RISCV/GISel/RISCVCallLowering.cpp llvm/lib/Target/RISCV/RISCV.h llvm/lib/Target/RISCV/RISCVCallingConv.cpp llvm/lib/Target/RISCV/RISCVCallingConv.h llvm/lib/Target/RISCV/RISCVISelLowering.cpp llvm/lib/Target/RISCV/RISCVInstrInfo.cpp llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

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

``````````diff
diff --git a/clang/include/clang/AST/TypeBase.h b/clang/include/clang/AST/TypeBase.h
index 9f5c9c6ca..b60f2bc16 100644
--- a/clang/include/clang/AST/TypeBase.h
+++ b/clang/include/clang/AST/TypeBase.h
@@ -5591,10 +5591,9 @@ class FunctionProtoType final
           FunctionProtoType, QualType, SourceLocation,
           FunctionType::FunctionTypeExtraBitfields,
           FunctionType::FunctionTypeExtraAttributeInfo,
-          FunctionType::FunctionTypeArmAttributes,
-          FunctionType::ExceptionType, Expr *, FunctionDecl *,
-          FunctionType::ExtParameterInfo, Qualifiers, FunctionEffect,
-          EffectConditionExpr> {
+          FunctionType::FunctionTypeArmAttributes, FunctionType::ExceptionType,
+          Expr *, FunctionDecl *, FunctionType::ExtParameterInfo, Qualifiers,
+          FunctionEffect, EffectConditionExpr> {
   friend class ASTContext; // ASTContext creates these.
   friend TrailingObjects;
 
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index d334bcf07..2bf3e0850 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -5233,8 +5233,8 @@ QualType ASTContext::getFunctionTypeInternal(
       FunctionEffect, EffectConditionExpr>(
       NumArgs, EPI.Variadic, EPI.requiresFunctionProtoTypeExtraBitfields(),
       EPI.requiresFunctionProtoTypeExtraAttributeInfo(),
-      EPI.requiresFunctionProtoTypeArmAttributes(),
-      ESH.NumExceptionType, ESH.NumExprPtr, ESH.NumFunctionDeclPtr,
+      EPI.requiresFunctionProtoTypeArmAttributes(), ESH.NumExceptionType,
+      ESH.NumExprPtr, ESH.NumFunctionDeclPtr,
       EPI.ExtParameterInfos ? NumArgs : 0,
       EPI.TypeQuals.hasNonFastQualifiers() ? 1 : 0, EPI.FunctionEffects.size(),
       EPI.FunctionEffects.conditions().size());
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index b32889a01..77be48c0b 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -4844,8 +4844,7 @@ void Sema::checkCall(NamedDecl *FDecl, const FunctionProtoType *Proto,
       if (CallerFD) {
         QualType CallerType = CallerFD->getType();
         if (!CallerType.isNull()) {
-          if (const auto *CallerFPT =
-                  CallerType->getAs<FunctionProtoType>())
+          if (const auto *CallerFPT = CallerType->getAs<FunctionProtoType>())
             CallerRISCVState = FunctionType::getRISCVXsfmmState(
                 CallerFPT->getRISCVAttributes());
 
diff --git a/clang/lib/Sema/SemaRISCV.cpp b/clang/lib/Sema/SemaRISCV.cpp
index 0cffa3770..605b8dd6b 100644
--- a/clang/lib/Sema/SemaRISCV.cpp
+++ b/clang/lib/Sema/SemaRISCV.cpp
@@ -1639,8 +1639,7 @@ void SemaRISCV::checkConflictingStateAttributes(
   // tuple(CallerAttr, CalleeAttr, required feature)
   const std::tuple<FunctionType::RISCVStateValue, FunctionType::RISCVStateValue,
                    StringRef>
-      RISCVStateInfo[] = {
-          {CallerState, CalleeState, "xsfmmbase"}};
+      RISCVStateInfo[] = {{CallerState, CalleeState, "xsfmmbase"}};
   for (auto [CallerAttr, CalleeAttr, RequiredFeature] : RISCVStateInfo) {
     // If both caller and callee are not attributed, then we're fine.
     if (CallerAttr == FunctionType::RISCVNone &&

``````````

</details>


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


More information about the cfe-commits mailing list