[clang] [clang][OpenMP] Emit host diagnostics that were deferred and never flushed (PR #220316)

via cfe-commits cfe-commits at lists.llvm.org
Sat Oct 10 12:09:51 PDT 2026


================
@@ -2262,7 +2262,9 @@ Sema::SemaDiagnosticBuilder::~SemaDiagnosticBuilder() {
 Sema::SemaDiagnosticBuilder
 Sema::targetDiag(SourceLocation Loc, unsigned DiagID, const FunctionDecl *FD) {
   FD = FD ? FD : getCurFunctionDecl();
-  if (LangOpts.OpenMP)
+  // -fopenmp-simd has no device compilation and ignores 'declare target', so
+  // there is nothing to defer for.
+  if (LangOpts.OpenMP && !LangOpts.OpenMPSimd)
----------------
pgerell wrote:

They aren't both set: `OpenMPSimd = !OpenMP && IsSimdSpecified`, so it means "SIMD-only mode". With both flags we take the full OpenMP path, deferral included. `OpenMP && !OpenMPSimd` is the usual full-OpenMP check elsewhere in clang too. I reworded the comment to say so.

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


More information about the cfe-commits mailing list