[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 31 04:39: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:

done. This took me some time due to this bug:
https://github.com/llvm/llvm-project/blob/2c00df3c938a99a85f5b0abebbb541d2e003af2c/clang/lib/Sema/TreeTransform.h#L10940-L10949

(`C->getMessageString()` instead of `E.get()`)

I also adapted the error codegen and the corresponding test so that the whole thing gets enough testing. Otherwise, I think things might get confusing.

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


More information about the llvm-branch-commits mailing list