[clang] [C] Disallow declarations where a statement is required (PR #92908)

2024-05-28 Thread via cfe-commits
@@ -239,7 +239,10 @@ StmtResult Parser::ParseStatementOrDeclarationAfterAttributes( auto IsStmtAttr = [](ParsedAttr ) { return Attr.isStmtAttr(); }; bool AllAttrsAreStmtAttrs = llvm::all_of(CXX11Attrs, IsStmtAttr) &&

[clang] [C] Disallow declarations where a statement is required (PR #92908)

2024-05-28 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman closed https://github.com/llvm/llvm-project/pull/92908 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [C] Disallow declarations where a statement is required (PR #92908)

2024-05-28 Thread Aaron Ballman via cfe-commits
@@ -239,7 +239,10 @@ StmtResult Parser::ParseStatementOrDeclarationAfterAttributes( auto IsStmtAttr = [](ParsedAttr ) { return Attr.isStmtAttr(); }; bool AllAttrsAreStmtAttrs = llvm::all_of(CXX11Attrs, IsStmtAttr) &&

[clang] [C] Disallow declarations where a statement is required (PR #92908)

2024-05-28 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman updated https://github.com/llvm/llvm-project/pull/92908 >From 219dae02c3235c17bc4568496a7df9763d798e2a Mon Sep 17 00:00:00 2001 From: Aaron Ballman Date: Mon, 20 May 2024 13:40:28 -0400 Subject: [PATCH 1/5] [C] Fix declaration parsing

[clang] [C] Disallow declarations where a statement is required (PR #92908)

2024-05-28 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman updated https://github.com/llvm/llvm-project/pull/92908 >From 219dae02c3235c17bc4568496a7df9763d798e2a Mon Sep 17 00:00:00 2001 From: Aaron Ballman Date: Mon, 20 May 2024 13:40:28 -0400 Subject: [PATCH 1/4] [C] Fix declaration parsing

[clang] [C] Disallow declarations where a statement is required (PR #92908)

2024-05-23 Thread via cfe-commits
@@ -467,15 +467,18 @@ class Parser : public CodeCompletionHandler { /// Flags describing a context in which we're parsing a statement. enum class ParsedStmtContext { +/// This context permits declarations in language modes where declarations +/// are not

[clang] [C] Disallow declarations where a statement is required (PR #92908)

2024-05-23 Thread via cfe-commits
@@ -239,7 +239,10 @@ StmtResult Parser::ParseStatementOrDeclarationAfterAttributes( auto IsStmtAttr = [](ParsedAttr ) { return Attr.isStmtAttr(); }; bool AllAttrsAreStmtAttrs = llvm::all_of(CXX11Attrs, IsStmtAttr) &&

[clang] [C] Disallow declarations where a statement is required (PR #92908)

2024-05-23 Thread via cfe-commits
https://github.com/cor3ntin edited https://github.com/llvm/llvm-project/pull/92908 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [C] Disallow declarations where a statement is required (PR #92908)

2024-05-23 Thread via cfe-commits
https://github.com/cor3ntin approved this pull request. LGTM modulo comment https://github.com/llvm/llvm-project/pull/92908 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [C] Disallow declarations where a statement is required (PR #92908)

2024-05-22 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: It gets set a few lines down for `Compound`: `Compound = AllowDeclarationsInC | AllowStandaloneOpenMPDirectives` https://github.com/llvm/llvm-project/pull/92908 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [C] Disallow declarations where a statement is required (PR #92908)

2024-05-21 Thread Shafik Yaghmour via cfe-commits
@@ -467,15 +467,18 @@ class Parser : public CodeCompletionHandler { /// Flags describing a context in which we're parsing a statement. enum class ParsedStmtContext { +/// This context permits declarations in language modes where declarations +/// are not

[clang] [C] Disallow declarations where a statement is required (PR #92908)

2024-05-21 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: I'm less certain, but CC @jdoerfert @mikerice1969 for more opinions. The original changes actually fixed a bug in OpenMP related to standalone directives. > Note, this seems to have fixed an issue with some OpenMP stand-alone directives not being properly diagnosed as per:

[clang] [C] Disallow declarations where a statement is required (PR #92908)

2024-05-21 Thread Erich Keane via cfe-commits
https://github.com/erichkeane commented: The original patch changed some of the ParsedStmtContext's in ParseOMP that might need to be changed back? Looking back, I think the intent there was in part to not specify OMP standalone directives, so that part should be reverted as well perhaps?

[clang] [C] Disallow declarations where a statement is required (PR #92908)

2024-05-21 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: Aaron Ballman (AaronBallman) Changes This fixes a regression introduced in 8bd06d5b65845e5e01dd899a2deb773580460b89 where Clang began to accept a declaration where a statement is required. e.g., ``` if (1) int x; // Previously accepted,

[clang] [C] Disallow declarations where a statement is required (PR #92908)

2024-05-21 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman created https://github.com/llvm/llvm-project/pull/92908 This fixes a regression introduced in 8bd06d5b65845e5e01dd899a2deb773580460b89 where Clang began to accept a declaration where a statement is required. e.g., ``` if (1) int x; // Previously accepted, now