[clang] [Clang][OpenMP] Fixed an assertion when `#pragma omp declare simd` or `#pragma omp declare variant` is followed by another OpenMP declarative directive containing a qualified identifier (PR #217875)
Shengxin Pei via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 21 10:14:27 PDT 2026
================
@@ -2214,6 +2214,22 @@ Parser::DeclGroupPtrTy Parser::ParseOpenMPDeclarativeDirectiveWithExtDecl(
<< (DKind == OMPD_declare_simd ? 0 : 1);
return DeclGroupPtrTy();
}
+
+ DeclGroupRef DG = Ptr.get();
+ bool HasNewDecl = false;
+ SourceManager &SM = PP.getSourceManager();
+ for (const Decl *D : DG) {
+ if (SM.isBeforeInTranslationUnit(Loc, D->getBeginLoc())) {
+ HasNewDecl = true;
+ break;
+ }
+ }
----------------
TPPPP72 wrote:
Used `llvm::any_of` as requested by @zwuis.
https://github.com/llvm/llvm-project/pull/217875
More information about the cfe-commits
mailing list