[clang] [CIR] Upstream Exception Attr in CallOp (PR #164964)

Amr Hesham via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 27 12:01:28 PDT 2025


================
@@ -729,9 +735,15 @@ static mlir::ParseResult parseCallCommon(mlir::OpAsmParser &parser,
   if (parser.parseRParen())
     return mlir::failure();
 
-  if (parser.parseOptionalKeyword("nothrow").succeeded())
+  llvm::SMLoc optionalNothrowLoc = parser.getCurrentLocation();
+  if (parser.parseOptionalKeyword("nothrow").succeeded()) {
+    if (hasExceptions)
+      return parser.emitError(
+          optionalNothrowLoc,
+          "should have either `exception` or `nothrow`, but not both");
----------------
AmrDeveloper wrote:

> (b) if you are calling a nothrow function decl inside a try block, how do you differentiate between them at lowering time?

In FlattenCGF, we convert a call with `!nothrow` or `hasException` to TryCallOp, so at the lowering we have 2 kinds of calls: CallOp, TryCallOp 🤔 

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


More information about the cfe-commits mailing list