This repository was archived by the owner on Feb 21, 2026. It is now read-only.
[CIR] Make nothrow explicit function attribute#2028
Draft
xlauko wants to merge 1 commit intographite-base/2028from
Draft
[CIR] Make nothrow explicit function attribute#2028xlauko wants to merge 1 commit intographite-base/2028from
xlauko wants to merge 1 commit intographite-base/2028from
Conversation
Collaborator
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. |
You can test this locally with the following command:git-clang-format --diff origin/main HEAD --extensions cl,cpp,c -- clang/lib/CIR/CodeGen/CIRGenCall.cpp clang/lib/CIR/CodeGen/CIRGenFunction.cpp clang/lib/CIR/CodeGen/CIRGenModule.cpp 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/OpenCL/nothrow.cl clang/test/CIR/CodeGen/call-extra-attrs.cpp clang/test/CIR/CodeGen/conditional-cleanup.cpp clang/test/CIR/CodeGen/coro-task.cpp clang/test/CIR/CodeGen/default-methods.cpp clang/test/CIR/CodeGen/function-attrs.cpp clang/test/CIR/CodeGen/hello.c clang/test/CIR/CodeGen/lambda.cpp clang/test/CIR/CodeGen/null-arithmatic-expression.c clang/test/CIR/CodeGen/optnone.cpp clang/test/CIR/CodeGen/temporaries.cpp --diff_from_common_commit
View the diff from clang-format here.diff --git a/clang/lib/CIR/CodeGen/CIRGenCall.cpp b/clang/lib/CIR/CodeGen/CIRGenCall.cpp
index d1701c638..48bea18dc 100644
--- a/clang/lib/CIR/CodeGen/CIRGenCall.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenCall.cpp
@@ -407,8 +407,8 @@ emitCallLikeOp(CIRGenFunction &CGF, mlir::Location callLoc,
callLoc, indirectFuncVal, indirectFuncTy, CIRCallArgs,
cir::CallingConv::C, sideEffect, extraFnAttrs);
} else {
- callOp = builder.createCallOp(callLoc, directFuncOp, CIRCallArgs, callingConv,
- sideEffect, extraFnAttrs);
+ callOp = builder.createCallOp(callLoc, directFuncOp, CIRCallArgs,
+ callingConv, sideEffect, extraFnAttrs);
}
if (cannotThrow)
callOp->setAttr("nothrow", builder.getUnitAttr());
@@ -652,9 +652,10 @@ RValue CIRGenFunction::emitCall(const CIRGenFunctionInfo &CallInfo,
auto extraFnAttrs = cir::ExtraFuncAttributesAttr::get(
Attrs.getDictionary(&getMLIRContext()));
- cir::CIRCallOpInterface callLikeOp = emitCallLikeOp(
- *this, callLoc, indirectFuncTy, indirectFuncVal, directFuncOp,
- CIRCallArgs, isInvoke, callingConv, sideEffect, extraFnAttrs, CannotThrow);
+ cir::CIRCallOpInterface callLikeOp =
+ emitCallLikeOp(*this, callLoc, indirectFuncTy, indirectFuncVal,
+ directFuncOp, CIRCallArgs, isInvoke, callingConv,
+ sideEffect, extraFnAttrs, CannotThrow);
if (E)
callLikeOp->setAttr("ast",
diff --git a/clang/lib/CIR/Dialect/IR/CIRDialect.cpp b/clang/lib/CIR/Dialect/IR/CIRDialect.cpp
index 5aaf6af13..c16497b15 100644
--- a/clang/lib/CIR/Dialect/IR/CIRDialect.cpp
+++ b/clang/lib/CIR/Dialect/IR/CIRDialect.cpp
@@ -2937,14 +2937,26 @@ void cir::FuncOp::print(OpAsmPrinter &p) {
function_interface_impl::printFunctionAttributes(
p, *this,
// These are all omitted since they are custom printed already.
- {getAliaseeAttrName(), getBuiltinAttrName(), getCoroutineAttrName(),
- getDsoLocalAttrName(), getNothrowAttrName(), getExtraAttrsAttrName(),
- getFunctionTypeAttrName(), getGlobalCtorPriorityAttrName(),
- getGlobalDtorPriorityAttrName(), getLambdaAttrName(),
- getLinkageAttrName(), getCallingConvAttrName(), getNoProtoAttrName(),
- getSymVisibilityAttrName(), getArgAttrsAttrName(), getResAttrsAttrName(),
- getComdatAttrName(), getGlobalVisibilityAttrName(),
- getAnnotationsAttrName(), getCxxSpecialMemberAttrName()});
+ {getAliaseeAttrName(),
+ getBuiltinAttrName(),
+ getCoroutineAttrName(),
+ getDsoLocalAttrName(),
+ getNothrowAttrName(),
+ getExtraAttrsAttrName(),
+ getFunctionTypeAttrName(),
+ getGlobalCtorPriorityAttrName(),
+ getGlobalDtorPriorityAttrName(),
+ getLambdaAttrName(),
+ getLinkageAttrName(),
+ getCallingConvAttrName(),
+ getNoProtoAttrName(),
+ getSymVisibilityAttrName(),
+ getArgAttrsAttrName(),
+ getResAttrsAttrName(),
+ getComdatAttrName(),
+ getGlobalVisibilityAttrName(),
+ getAnnotationsAttrName(),
+ getCxxSpecialMemberAttrName()});
if (auto aliaseeName = getAliasee()) {
p << " alias(";
|
5805186 to
418da21
Compare
9e47299 to
b292185
Compare
bcardosolopes
approved these changes
Nov 26, 2025
Member
bcardosolopes
left a comment
There was a problem hiding this comment.
I like this approach, LGTM when it comes out of draft + fixed failures
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

No description provided.