Author: Erich Keane Date: 2026-06-13T08:41:40Z New Revision: b48dd92d8e00b4a2940dd539722444bf0dd2ef65
URL: https://github.com/llvm/llvm-project/commit/b48dd92d8e00b4a2940dd539722444bf0dd2ef65 DIFF: https://github.com/llvm/llvm-project/commit/b48dd92d8e00b4a2940dd539722444bf0dd2ef65.diff LOG: [OpenACC] Fix scope setup for OpenACC directives without scope. (#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 Added: clang/test/ParserOpenACC/directive-scope-setup.cpp Modified: clang/lib/Parse/ParseOpenACC.cpp Removed: clang/test/ParserOpenACC/gh197858.cpp ################################################################################ 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
