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

Johannes Doerfert via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 21 09:37:40 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");
----------------
jdoerfert wrote:

0 does make sense since the "real" values are dates in increasing order.


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


More information about the cfe-commits mailing list