[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 11:00:19 PDT 2026
================
@@ -2215,17 +2215,11 @@ Parser::DeclGroupPtrTy Parser::ParseOpenMPDeclarativeDirectiveWithExtDecl(
return DeclGroupPtrTy();
}
- auto HasNewDecl = [&] {
- DeclGroupRef DG = Ptr.get();
- SourceManager &SM = PP.getSourceManager();
- for (const Decl *D : DG) {
- if (SM.isBeforeInTranslationUnit(Loc, D->getBeginLoc()))
- return true;
- }
- return false;
- };
-
- if (!HasNewDecl()) {
+ DeclGroupRef DG = Ptr.get();
+ SourceManager &SM = PP.getSourceManager();
+ if (!llvm::any_of(DG, [&](const Decl *D) {
+ return SM.isBeforeInTranslationUnit(Loc, D->getBeginLoc());
+ })) {
----------------
TPPPP72 wrote:
@alexey-bataev Oh, it should be `SM.isBeforeInTranslationUnit(Loc, D->getBeginLoc());` not `!SM.isBeforeInTranslationUnit(Loc, D->getBeginLoc());` ^_^
https://github.com/llvm/llvm-project/pull/217875
More information about the cfe-commits
mailing list