[llvm-branch-commits] [clang] [llvm] [OpenMP][clang] 6.0: num_threads strict (part 3: codegen) (PR #146405)

Robert Imschweiler via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Jul 24 02:02:12 PDT 2025


================
@@ -2718,11 +2718,14 @@ void CGOpenMPRuntime::emitNumThreadsClause(
     // as if sev-level is fatal."
     Args.push_back(llvm::ConstantInt::get(
         CGM.Int32Ty, Severity == OMPC_SEVERITY_warning ? 1 : 2));
-    if (Message)
-      Args.push_back(CGF.EmitStringLiteralLValue(cast<StringLiteral>(Message))
-                         .getPointer(CGF));
-    else
+    if (Message) {
+      if (const StringLiteral *Msg = dyn_cast<StringLiteral>(Message))
+        Args.push_back(CGF.EmitStringLiteralLValue(Msg).getPointer(CGF));
+      else
----------------
ro-i wrote:

At the moment, sema just forwards the message expr. Since, from my current understanding, a literal string needs to be handled differently from a `const char *` variable (although they are kind of the same thing), I need to make the distinction. See also the code in the current `emitErrorCall` handling:
https://github.com/llvm/llvm-project/blob/5c7c8558c856712a5ef11ff5f4e7ea7d3567f625/clang/lib/CodeGen/CGOpenMPRuntime.cpp#L2375-L2378

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


More information about the llvm-branch-commits mailing list