[clang] [HIP] Define `_OPENMP` on the device for mixed OpenMP CPU compilations (PR #176791)

Matt Arsenault via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 20 05:22:02 PST 2026


================
@@ -1460,6 +1460,11 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
     }
   }
 
+  // CUDA / HIP offloading only supports OpenMP's CPU support, but both
+  // compilations must define these macros to compile.
+  if (LangOpts.OpenMPMacros)
+    Builder.defineMacro("_OPENMP", "0");
----------------
arsenm wrote:

Weird to define as 0? How does that make sense?

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


More information about the cfe-commits mailing list