-
Notifications
You must be signed in to change notification settings - Fork 183
[CIR] Make nothrow explicit function attribute #2028
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
base: graphite-base/2028
Are you sure you want to change the base?
Conversation
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
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
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this approach, LGTM when it comes out of draft + fixed failures

No description provided.