[clang] [ThreadSafety][NFC] Cleanup indentation and unnecessary comments (PR #181896)
Ziqing Luo via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 17 12:16:10 PST 2026
https://github.com/ziqingluo-90 created https://github.com/llvm/llvm-project/pull/181896
This is a follow-up commit to #178952 for indentation and comments cleanups.
>From 644e19fab6f1b60f77f1eb2c29ae2eeba09c7368 Mon Sep 17 00:00:00 2001
From: Ziqing Luo <ziqing_luo at apple.com>
Date: Tue, 17 Feb 2026 12:12:08 -0800
Subject: [PATCH] [ThreadSafety][NFC] Cleanup indentation and unnecessary
comments
This is a follow-up commit to #178952 for indentation and comments
cleanups.
---
clang/lib/Analysis/ThreadSafety.cpp | 3 ---
.../SemaCXX/warn-thread-safety-analysis.cpp | 20 +++++++++----------
2 files changed, 10 insertions(+), 13 deletions(-)
diff --git a/clang/lib/Analysis/ThreadSafety.cpp b/clang/lib/Analysis/ThreadSafety.cpp
index 901624acd6f75..2c5976af9f61d 100644
--- a/clang/lib/Analysis/ThreadSafety.cpp
+++ b/clang/lib/Analysis/ThreadSafety.cpp
@@ -1727,9 +1727,6 @@ class BuildLockset : public ConstStmtVisitor<BuildLockset> {
FactSet FSet;
// The fact set for the function on exit.
const FactSet &FunctionExitFSet;
- // Use `LVarCtx` to keep track of the context at each program point, which
- // will be used to translate variables (by `SExprBuilder::translateVariable`)
- // to their canonical definitions:
LocalVariableMap::Context LVarCtx;
unsigned CtxIndex;
diff --git a/clang/test/SemaCXX/warn-thread-safety-analysis.cpp b/clang/test/SemaCXX/warn-thread-safety-analysis.cpp
index b878a37747f2f..a6c9a2236fc45 100644
--- a/clang/test/SemaCXX/warn-thread-safety-analysis.cpp
+++ b/clang/test/SemaCXX/warn-thread-safety-analysis.cpp
@@ -7487,20 +7487,20 @@ void testPointerAliasEscapeAndReset(Foo *f) {
// A function that may do anything to the objects referred to by the inputs.
void escapeAliasMultiple(void *, void *, void *);
void testPointerAliasEscapeMultiple(Foo *F) {
- Foo *L;
- F->mu.Lock(); // expected-note{{mutex acquired here}}
- Foo *Fp = F;
- escapeAliasMultiple(&L, &L, &Fp);
- Fp->mu.Unlock(); // expected-warning{{releasing mutex 'Fp->mu' that was not held}}
+ Foo *L;
+ F->mu.Lock(); // expected-note{{mutex acquired here}}
+ Foo *Fp = F;
+ escapeAliasMultiple(&L, &L, &Fp);
+ Fp->mu.Unlock(); // expected-warning{{releasing mutex 'Fp->mu' that was not held}}
} // expected-warning{{mutex 'F->mu' is still held at the end of function}}
void unlockFooWithEscapablePointer(Foo **Fp) EXCLUSIVE_UNLOCK_FUNCTION((*Fp)->mu);
void testEscapeInvalidationHappensRightAfterTheCall(Foo* F) {
- Foo* L;
- L = F;
- L->mu.Lock();
- // Release the lock held by 'L' before clearing its definition.
- unlockFooWithEscapablePointer(&L);
+ Foo* L;
+ L = F;
+ L->mu.Lock();
+ // Release the lock held by 'L' before clearing its definition.
+ unlockFooWithEscapablePointer(&L);
}
void testEscapeInvalidationHappensRightAfterTheCtorCall(Foo* F) {
More information about the cfe-commits
mailing list