[clang] [CIR] Add inline function attributes (PR #162866)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 10 08:22:45 PDT 2025
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/CIR/CodeGen/inline-attributes.cpp clang/include/clang/CIR/MissingFeatures.h clang/lib/CIR/CodeGen/CIRGenCXX.cpp clang/lib/CIR/CodeGen/CIRGenModule.cpp clang/lib/CIR/CodeGen/CIRGenModule.h clang/lib/CIR/Dialect/IR/CIRDialect.cpp clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVMIR.cpp clang/test/CIR/CodeGen/array.cpp clang/test/CIR/CodeGen/assign-operator.cpp clang/test/CIR/CodeGen/binassign.c clang/test/CIR/CodeGen/bitfields_be.c clang/test/CIR/CodeGen/builtin_call.cpp clang/test/CIR/CodeGen/builtin_printf.cpp clang/test/CIR/CodeGen/call.c clang/test/CIR/CodeGen/call.cpp clang/test/CIR/CodeGen/cmp.cpp clang/test/CIR/CodeGen/comma.c clang/test/CIR/CodeGen/ctor.cpp clang/test/CIR/CodeGen/dtors.cpp clang/test/CIR/CodeGen/label.c clang/test/CIR/CodeGen/lambda-static-invoker.cpp clang/test/CIR/CodeGen/lambda.cpp clang/test/CIR/CodeGen/linkage-spec.cpp clang/test/CIR/CodeGen/loop.cpp clang/test/CIR/CodeGen/member-functions.cpp clang/test/CIR/CodeGen/nrvo.cpp clang/test/CIR/CodeGen/ternary.cpp clang/test/CIR/CodeGen/vbase.cpp clang/test/CIR/CodeGen/vtt.cpp
``````````
: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/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp b/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp
index ec3100d8e..32be11239 100644
--- a/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp
+++ b/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp
@@ -1626,7 +1626,7 @@ mlir::LogicalResult CIRToLLVMFuncOpLowering::matchAndRewrite(
// Add inline_kind attribute with "cir." prefix so amendOperation handles it
if (auto inlineKind = op.getInlineKind()) {
- fn->setAttr("cir.inline_kind",
+ fn->setAttr("cir.inline_kind",
cir::InlineAttr::get(getContext(), *inlineKind));
}
diff --git a/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVMIR.cpp b/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVMIR.cpp
index 95698c48d..9f3a132d6 100644
--- a/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVMIR.cpp
+++ b/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVMIR.cpp
@@ -66,7 +66,8 @@ public:
mlir::NamedAttribute attribute,
mlir::LLVM::ModuleTranslation &moduleTranslation) const {
llvm::Function *llvmFunc = moduleTranslation.lookupFunction(func.getName());
- if (auto inlineAttr = mlir::dyn_cast<cir::InlineAttr>(attribute.getValue())) {
+ if (auto inlineAttr =
+ mlir::dyn_cast<cir::InlineAttr>(attribute.getValue())) {
if (inlineAttr.isNoInline())
llvmFunc->addFnAttr(llvm::Attribute::NoInline);
else if (inlineAttr.isAlwaysInline())
``````````
</details>
https://github.com/llvm/llvm-project/pull/162866
More information about the cfe-commits
mailing list