[clang] [clang][ThreadSafety] Enable late parse for all capabilities, under the experimental flag (PR #212615)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 24 07:38:42 PDT 2026
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions c,cpp,h -- clang/test/Sema/warn-thread-safety-late-parsing.c clang/test/SemaCXX/warn-thread-safety-late-parsing.cpp clang/include/clang/Parse/Parser.h clang/include/clang/Sema/Sema.h clang/lib/Parse/ParseCXXInlineMethods.cpp clang/lib/Parse/ParseDecl.cpp clang/lib/Sema/SemaDecl.cpp clang/test/Sema/warn-thread-safety-analysis.c --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/lib/Parse/ParseCXXInlineMethods.cpp b/clang/lib/Parse/ParseCXXInlineMethods.cpp
index 14dd1a9d3..051a63819 100644
--- a/clang/lib/Parse/ParseCXXInlineMethods.cpp
+++ b/clang/lib/Parse/ParseCXXInlineMethods.cpp
@@ -753,7 +753,8 @@ void Parser::ParseLexedAttribute(LateParsedAttribute &LPA, bool EnterScope,
// scope would be looked up as a member of it, so nest a prototype scope as
// there was when the attribute was written.
bool HasProtoParams = !HasFuncScope && !LPA.ProtoParams.empty();
- ParseScope ProtoScope(this, Scope::FunctionPrototypeScope | Scope::DeclScope,
+ ParseScope ProtoScope(this,
+ Scope::FunctionPrototypeScope | Scope::DeclScope,
HasProtoParams && IsCPlusPlus);
if (HasProtoParams)
Actions.ActOnReenterFunctionPrototypeParams(Actions.getCurScope(),
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp
index 573274c29..4c60f7325 100644
--- a/clang/lib/Parse/ParseDecl.cpp
+++ b/clang/lib/Parse/ParseDecl.cpp
@@ -197,8 +197,9 @@ bool Parser::ParseSingleGNUAttribute(ParsedAttributes &Attrs,
new LateParsedAttribute(this, *AttrName, AttrNameLoc);
// Keep the innermost prototype's parameters available in case they are needed
- // by late-parsing attributes. A function keeps its own parameters in scope, so
- // skip it; a parameter of function type is adjusted to a pointer, so keep it.
+ // by late-parsing attributes. A function keeps its own parameters in scope,
+ // so skip it; a parameter of function type is adjusted to a pointer, so keep
+ // it.
if (D && (!D->isFunctionDeclarator() || D->isPrototypeContext())) {
for (unsigned I = 0, E = D->getNumTypeObjects(); I != E; ++I) {
const DeclaratorChunk &Chunk = D->getTypeObject(I);
``````````
</details>
https://github.com/llvm/llvm-project/pull/212615
More information about the cfe-commits
mailing list