https://github.com/erichkeane created 
https://github.com/llvm/llvm-project/pull/203687

When implementing these, I intended to have the 'empty' parse scopes for most 
of the directives introduced for simplicity.  However some assertions show that 
this is not a valid use of this, as it doesn't tolerate 'empty' parse scopes. 
This patch stops introducing one.

Fixes: #203679

>From 011fc75c05ca3d8ab8c864bba6649552ffe81489 Mon Sep 17 00:00:00 2001
From: erichkeane <[email protected]>
Date: Sat, 13 Jun 2026 00:57:22 -0700
Subject: [PATCH] [OpenACC] Fix scope setup for OpenACC directives without
 scope.

When implementing these, I intended to have the 'empty' parse scopes for most
of the directives introduced for simplicity.  However some assertions
show that this is not a valid use of this, as it doesn't tolerate
'empty' parse scopes. This patch stops introducing one.

Fixes: #203679
---
 clang/lib/Parse/ParseOpenACC.cpp                              | 4 +++-
 .../ParserOpenACC/{gh197858.cpp => directive-scope-setup.cpp} | 2 ++
 2 files changed, 5 insertions(+), 1 deletion(-)
 rename clang/test/ParserOpenACC/{gh197858.cpp => directive-scope-setup.cpp} 
(76%)

diff --git a/clang/lib/Parse/ParseOpenACC.cpp b/clang/lib/Parse/ParseOpenACC.cpp
index a95c5730a001c..ba6f25de0ed6b 100644
--- a/clang/lib/Parse/ParseOpenACC.cpp
+++ b/clang/lib/Parse/ParseOpenACC.cpp
@@ -1682,7 +1682,9 @@ StmtResult Parser::ParseOpenACCDirectiveStmt() {
         getActions().OpenACC(), DirInfo.DirKind, DirInfo.DirLoc, {},
         DirInfo.Clauses);
     ParsingOpenACCDirectiveRAII DirScope(*this, /*Value=*/false);
-    ParseScope ACCScope(this, getOpenACCScopeFlags(DirInfo.DirKind));
+
+    unsigned scopeFlags = getOpenACCScopeFlags(DirInfo.DirKind);
+    ParseScope ACCScope(this, scopeFlags, /*EnteredScope=*/scopeFlags != 0);
 
     AssocStmt = getActions().OpenACC().ActOnAssociatedStmt(
         DirInfo.StartLoc, DirInfo.DirKind, DirInfo.AtomicKind, DirInfo.Clauses,
diff --git a/clang/test/ParserOpenACC/gh197858.cpp 
b/clang/test/ParserOpenACC/directive-scope-setup.cpp
similarity index 76%
rename from clang/test/ParserOpenACC/gh197858.cpp
rename to clang/test/ParserOpenACC/directive-scope-setup.cpp
index 20046d79c3f16..8fdc3cc9ac4fa 100644
--- a/clang/test/ParserOpenACC/gh197858.cpp
+++ b/clang/test/ParserOpenACC/directive-scope-setup.cpp
@@ -7,4 +7,6 @@ void func() {
   using j; // expected-error{{using declaration requires a qualified name}}
 #pragma acc parallel loop
   using k; // expected-error{{using declaration requires a qualified name}}
+#pragma acc data default(none)
+  using l; // expected-error{{using declaration requires a qualified name}}
 }

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to