https://github.com/melver updated
https://github.com/llvm/llvm-project/pull/142955
>From c8d76f8f31b61d9789a8f816a2bd1aeff652feb5 Mon Sep 17 00:00:00 2001
From: Marco Elver
Date: Wed, 21 May 2025 23:49:48 +0200
Subject: [PATCH 1/3] Thread Safety Analysis: Basic capability alias-analysis
Add ba
@@ -1012,6 +1030,107 @@ void SExprBuilder::exitCFG(const CFGBlock *Last) {
IncompleteArgs.clear();
}
+bool SExprBuilder::isVariableReassigned(const VarDecl *VD) {
+ // Note: The search is performed lazily per-variable and result is cached. An
+ // alternative would have be
https://github.com/melver updated
https://github.com/llvm/llvm-project/pull/142955
>From f2685208390325e663b48e52606b2f7deed5fb5d Mon Sep 17 00:00:00 2001
From: Marco Elver
Date: Wed, 21 May 2025 23:49:48 +0200
Subject: [PATCH 1/2] Thread Safety Analysis: Basic capability alias-analysis
Add ba
https://github.com/melver updated
https://github.com/llvm/llvm-project/pull/142955
>From 0ddf3a5995c2596a2bfe07db6e59d118783a29be Mon Sep 17 00:00:00 2001
From: Marco Elver
Date: Wed, 21 May 2025 23:49:48 +0200
Subject: [PATCH] Thread Safety Analysis: Basic capability alias-analysis
Add basic
melver wrote:
Just FYI - I rebased the kernel patches, and attempted to apply -Wthread-safety
to kernel/sched/, which previously was impossible.
With this PR, it *does* work with modest changes (most are annotations, only
few some small code changes):
https://git.kernel.org/pub/scm/linux/kern
@@ -148,129 +148,54 @@ StringRef getBinaryOpcodeString(TIL_BinaryOpcode Op);
/// All variables and expressions must have a value type.
/// Pointer types are further subdivided into the various heap-allocated
/// types, such as functions, records, etc.
-/// Structured types that
https://github.com/melver approved this pull request.
https://github.com/llvm/llvm-project/pull/148551
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
melver wrote:
> I've been trying to implement this in `ThreadSafety.cpp`, and it does seem to
> work, but I ended up at the same conclusion that you had originally: that we
> don't need to warn about this. It's certainly a strange thing to write, but
> warnings are mostly about preventing acci
https://github.com/melver closed
https://github.com/llvm/llvm-project/pull/141599
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/melver approved this pull request.
https://github.com/llvm/llvm-project/pull/149660
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -1012,6 +1030,107 @@ void SExprBuilder::exitCFG(const CFGBlock *Last) {
IncompleteArgs.clear();
}
+bool SExprBuilder::isVariableReassigned(const VarDecl *VD) {
+ // Note: The search is performed lazily per-variable and result is cached. An
+ // alternative would have be
https://github.com/melver updated
https://github.com/llvm/llvm-project/pull/142955
>From 07bc50ce05954e684dfc08d37d1af854f63e62e7 Mon Sep 17 00:00:00 2001
From: Marco Elver
Date: Wed, 21 May 2025 23:49:48 +0200
Subject: [PATCH] Thread Safety Analysis: Basic capability alias-analysis
Add basic
https://github.com/melver updated
https://github.com/llvm/llvm-project/pull/142955
>From e5e2f35fb5f528ab4bba0422825a8a8bd7e86a9f Mon Sep 17 00:00:00 2001
From: Marco Elver
Date: Wed, 21 May 2025 23:49:48 +0200
Subject: [PATCH] Thread Safety Analysis: Basic capability alias-analysis
Add basic
@@ -1012,6 +1030,107 @@ void SExprBuilder::exitCFG(const CFGBlock *Last) {
IncompleteArgs.clear();
}
+bool SExprBuilder::isVariableReassigned(const VarDecl *VD) {
+ // Note: The search is performed lazily per-variable and result is cached. An
+ // alternative would have be
@@ -1012,6 +1030,107 @@ void SExprBuilder::exitCFG(const CFGBlock *Last) {
IncompleteArgs.clear();
}
+bool SExprBuilder::isVariableReassigned(const VarDecl *VD) {
+ // Note: The search is performed lazily per-variable and result is cached. An
+ // alternative would have be
https://github.com/melver edited
https://github.com/llvm/llvm-project/pull/142955
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/melver edited
https://github.com/llvm/llvm-project/pull/142955
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/melver edited
https://github.com/llvm/llvm-project/pull/142955
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/melver edited
https://github.com/llvm/llvm-project/pull/142955
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/melver updated
https://github.com/llvm/llvm-project/pull/142955
>From b4b995bdd7b46ca64440781f214ae6c11de4501b Mon Sep 17 00:00:00 2001
From: Marco Elver
Date: Wed, 21 May 2025 23:49:48 +0200
Subject: [PATCH] Thread Safety Analysis: Basic capability alias-analysis
Add basic
@@ -1012,6 +1030,107 @@ void SExprBuilder::exitCFG(const CFGBlock *Last) {
IncompleteArgs.clear();
}
+bool SExprBuilder::isVariableReassigned(const VarDecl *VD) {
+ // Note: The search is performed lazily per-variable and result is cached. An
+ // alternative would have be
@@ -1012,6 +1030,107 @@ void SExprBuilder::exitCFG(const CFGBlock *Last) {
IncompleteArgs.clear();
}
+bool SExprBuilder::isVariableReassigned(const VarDecl *VD) {
+ // Note: The search is performed lazily per-variable and result is cached. An
+ // alternative would have be
@@ -241,7 +242,21 @@ CapabilityExpr SExprBuilder::translateAttrExpr(const Expr
*AttrExp,
return CapabilityExpr(E, AttrExp->getType(), Neg);
}
-til::LiteralPtr *SExprBuilder::createVariable(const VarDecl *VD) {
+til::SExpr *SExprBuilder::translateVarDecl(const VarDecl *VD,
+
https://github.com/melver edited
https://github.com/llvm/llvm-project/pull/149660
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -941,43 +966,68 @@ class LockableFactEntry : public FactEntry {
}
};
-class ScopedLockableFactEntry : public FactEntry {
+enum UnderlyingCapabilityKind {
+ UCK_Acquired, ///< Any kind of acquired capability.
+ UCK_ReleasedShared,///< Shared capability that
https://github.com/melver commented:
LGTM in general, but this needs more comments around the new dangerous internal
API.
https://github.com/llvm/llvm-project/pull/149660
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/c
melver wrote:
> > Overall compilation before the change takes 327,801,317 instructions, and
> > 327,433,878 after the change
>
> Accidentally left assertions on. Without it's 277,111,134 versus 276,855,186,
> but this is also 0.1%, and Thread Safety Analysis is still roughly 1% of the
> overa
https://github.com/melver approved this pull request.
Thanks!
https://github.com/llvm/llvm-project/pull/150857
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -941,43 +966,68 @@ class LockableFactEntry : public FactEntry {
}
};
-class ScopedLockableFactEntry : public FactEntry {
+enum UnderlyingCapabilityKind {
+ UCK_Acquired, ///< Any kind of acquired capability.
+ UCK_ReleasedShared,///< Shared capability that
https://github.com/melver closed
https://github.com/llvm/llvm-project/pull/148974
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
melver wrote:
Some more self-review, and fixes:
- Rename createVariable() -> translateVarDecl() for clarify.
- Reintroduce createThisPlaceholder() for clarify.
- Handle escaping aliases through pass by-non-const-ref (or pointer), and add
more tests.
https://github.com/llvm/llvm-project/pull/14
https://github.com/melver updated
https://github.com/llvm/llvm-project/pull/142955
>From ff8f6e28e3adca1877ff2d16292aa8e23b7bfb9c Mon Sep 17 00:00:00 2001
From: Marco Elver
Date: Wed, 21 May 2025 23:49:48 +0200
Subject: [PATCH] Thread Safety Analysis: Very basic capability alias-analysis
Add a
https://github.com/melver updated
https://github.com/llvm/llvm-project/pull/142955
>From 0964bd446b730fd7c832bc8e3645320d3777627d Mon Sep 17 00:00:00 2001
From: Marco Elver
Date: Wed, 21 May 2025 23:49:48 +0200
Subject: [PATCH] Thread Safety Analysis: Very basic capability alias-analysis
Add a
https://github.com/melver updated
https://github.com/llvm/llvm-project/pull/141599
>From c66172eacbceb702370a54dfbcdae7dcb7bef4c5 Mon Sep 17 00:00:00 2001
From: Marco Elver
Date: Tue, 27 May 2025 15:12:11 +0200
Subject: [PATCH] Thread Safety Analysis: Warn when using negative reentrant
capabil
https://github.com/melver edited
https://github.com/llvm/llvm-project/pull/141599
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
melver wrote:
Gentle ping.
https://github.com/llvm/llvm-project/pull/142955
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
melver wrote:
Gentle ping.
https://github.com/llvm/llvm-project/pull/141599
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
melver wrote:
Cleaned it up some more.
https://github.com/llvm/llvm-project/pull/142955
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/melver ready_for_review
https://github.com/llvm/llvm-project/pull/142955
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/melver updated
https://github.com/llvm/llvm-project/pull/142955
>From 608c4f657e2bcc0591e2fc32606a6738445cade6 Mon Sep 17 00:00:00 2001
From: Marco Elver
Date: Wed, 21 May 2025 23:49:48 +0200
Subject: [PATCH] Thread Safety Analysis: Very basic capability alias-analysis
Add a
https://github.com/melver updated
https://github.com/llvm/llvm-project/pull/142955
>From c2dcde6db1d853bc4b30e8c5daf6165f7b45c6c6 Mon Sep 17 00:00:00 2001
From: Marco Elver
Date: Wed, 21 May 2025 23:49:48 +0200
Subject: [PATCH] Thread Safety Analysis: Very basic capability alias-analysis
Add a
melver wrote:
> Thanks for the new diagnostic! I think you should also add a release note to
> `clang/docs/ReleaseNotes.rst` so users know about the new diagnostic group.
Added and updated the ThreadSafetyAnalysis.rst document as well.
PTAL.
https://github.com/llvm/llvm-project/pull/141599
__
https://github.com/melver updated
https://github.com/llvm/llvm-project/pull/141599
>From 83695bf73a66fb0024393466578a61feb2f2cd1d Mon Sep 17 00:00:00 2001
From: Marco Elver
Date: Tue, 27 May 2025 15:12:11 +0200
Subject: [PATCH] Thread Safety Analysis: Warn when using negative reentrant
capabil
@@ -4222,6 +4222,11 @@ def warn_fun_requires_lock_precise :
InGroup, DefaultIgnore;
def note_found_mutex_near_match : Note<"found near match '%0'">;
+// Pedantic thread safety warnings enabled by default
+def warn_thread_reentrant_with_negative_capability : Warning<
+ "%0 i
melver wrote:
> On a related note, do we emit `-Wthread-safety-negative` for reentrant locks?
> I don't remember that we carved out an exception for that, and we probably
> should.
We do - and it's deliberate on my part as I've been trying to indicate that
there might be valid use cases for t
https://github.com/melver closed
https://github.com/llvm/llvm-project/pull/141500
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/melver created
https://github.com/llvm/llvm-project/pull/142955
Add a simple form of alias analysis for capabilities by substituting local
pointer variables with their initializers if they are `const` or never
reassigned.
For example, the analysis will no longer generate fa
melver wrote:
@aaronpuchert - RFC regarding basic capability alias analysis.
For the bare minimum this would work, and likely covers 90% of the cases I
worry about. I believe later enhancements could be built on top.
There might be something I'm missing though. Kindly take a look.
Many thanks!
https://github.com/melver edited
https://github.com/llvm/llvm-project/pull/141599
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/melver created
https://github.com/llvm/llvm-project/pull/141599
The purpose of negative capabilities is documented as helping to prevent double
locking, which is not an issue for most reentrant capabilities (such as
mutexes).
Introduce a pedantic warning group, which is ena
@@ -271,26 +271,32 @@ class CFGWalker {
// translateAttrExpr needs it, but that should be moved too.
class CapabilityExpr {
private:
- /// The capability expression and whether it's negated.
- llvm::PointerIntPair CapExpr;
+ /// The capability expression and flags.
+ llvm::
https://github.com/melver closed
https://github.com/llvm/llvm-project/pull/137133
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/melver created
https://github.com/llvm/llvm-project/pull/141500
In ScopedLockableFactEntry::unlock(), we can avoid a second search, pop_back(),
and push_back() if we use the already obtained iterator into the FactSet to
replace the old FactEntry and take its position in the
https://github.com/melver updated
https://github.com/llvm/llvm-project/pull/137133
>From b8754a894e8822c43dfce62b7d13d5169ea4a215 Mon Sep 17 00:00:00 2001
From: Marco Elver
Date: Thu, 24 Apr 2025 09:02:08 +0200
Subject: [PATCH] Thread Safety Analysis: Support reentrant capabilities
Introduce t
Author: Marco Elver
Date: 2025-05-26T16:59:51+02:00
New Revision: 365dcf48b8aa726fb6a9ace4b37eb1f1cf121941
URL:
https://github.com/llvm/llvm-project/commit/365dcf48b8aa726fb6a9ace4b37eb1f1cf121941
DIFF:
https://github.com/llvm/llvm-project/commit/365dcf48b8aa726fb6a9ace4b37eb1f1cf121941.diff
L
https://github.com/melver updated
https://github.com/llvm/llvm-project/pull/137133
>From bce9df281e5ea7c2efd9c880f791f6572732c31d Mon Sep 17 00:00:00 2001
From: Marco Elver
Date: Wed, 23 Apr 2025 11:31:25 +0200
Subject: [PATCH 1/2] Thread Safety Analysis: Convert CapabilityExpr::CapExpr
to hol
melver wrote:
> @melver, this request came from @AaronBallman. But since you're also working
> on Thread Safety Analysis in C, you might have some thoughts of your own
> about this.
>
> I haven't checked any real-world code yet. (Specifically, how many functions
> would be affected by this ex
melver wrote:
As additional motivation - quote from a kernel maintainer:
> But I think we should get the infrastructure in once your reentrancy
> support has landed in a release, because with that we can start
> annotation some code and show uses, while also helping to driver more
> requirements
https://github.com/melver updated
https://github.com/llvm/llvm-project/pull/137133
>From b264872c3f28f6cf172b0123087adda9d53dc1b9 Mon Sep 17 00:00:00 2001
From: Marco Elver
Date: Wed, 23 Apr 2025 11:31:25 +0200
Subject: [PATCH 1/2] Thread Safety Analysis: Convert CapabilityExpr::CapExpr
to hol
melver wrote:
Gentle ping - PTAL.
Many thanks!
https://github.com/llvm/llvm-project/pull/137133
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
melver wrote:
Thanks for the feedback. Addressed comments as best as I could.
Most notable changes:
- Also warns properly for loops with mismatching reentrancy depth.
- Devirtualized new helpers.
- Require ordering `reentrant_capability` after `capability`.
- Stylistic improvements.
PTAL.
http
@@ -235,6 +266,20 @@ class FactSet {
return false;
}
+ std::optional replaceLock(FactManager &FM, iterator It,
+std::unique_ptr Entry) {
+if (It == end())
+ return std::nullopt;
+FactID F = FM.newFact(std::move(Entry));
+
Author: Marco Elver
Date: 2025-05-09T20:14:30+02:00
New Revision: 49c22e3ee147326668aa0b2097f857d0b0c2a81e
URL:
https://github.com/llvm/llvm-project/commit/49c22e3ee147326668aa0b2097f857d0b0c2a81e
DIFF:
https://github.com/llvm/llvm-project/commit/49c22e3ee147326668aa0b2097f857d0b0c2a81e.diff
L
@@ -271,26 +272,34 @@ class CFGWalker {
// translateAttrExpr needs it, but that should be moved too.
class CapabilityExpr {
private:
- /// The capability expression and whether it's negated.
- llvm::PointerIntPair CapExpr;
+ static constexpr unsigned FlagNegative = 1u << 0;
@@ -1011,6 +979,30 @@ void SExprBuilder::exitCFG(const CFGBlock *Last) {
IncompleteArgs.clear();
}
+static CapabilityExpr makeCapabilityExpr(const til::SExpr *E, QualType VDT,
+ bool Neg) {
+ // We need to look at the declaration of t
@@ -271,26 +271,32 @@ class CFGWalker {
// translateAttrExpr needs it, but that should be moved too.
class CapabilityExpr {
private:
- /// The capability expression and whether it's negated.
- llvm::PointerIntPair CapExpr;
+ /// The capability expression and flags.
+ llvm::
@@ -4048,6 +4048,9 @@ def warn_thread_attribute_not_on_scoped_lockable_param :
Warning<
"%0 attribute applies to function parameters only if their type is a "
"reference to a 'scoped_lockable'-annotated type">,
InGroup, DefaultIgnore;
+def warn_reentrant_capability_witho
@@ -1078,22 +1091,65 @@ void
ModuleSanitizerCoverage::InjectCoverageAtBlock(Function &F, BasicBlock &BB,
Store->setNoSanitizeMetadata();
}
if (Options.StackDepth && IsEntryBB && !IsLeafFunc) {
-// Check stack depth. If it's the deepest so far, record it.
Modu
@@ -1078,22 +1091,65 @@ void
ModuleSanitizerCoverage::InjectCoverageAtBlock(Function &F, BasicBlock &BB,
Store->setNoSanitizeMetadata();
}
if (Options.StackDepth && IsEntryBB && !IsLeafFunc) {
-// Check stack depth. If it's the deepest so far, record it.
Modu
@@ -385,6 +385,49 @@ Users need to implement a single function to capture the
CF table at startup:
// the collected control flow.
}
+Tracing Stack Depth
+===
+
+With ``-fsanitize-coverage=stack-depth`` the compiler will track how much
+stack space has be
@@ -385,6 +385,49 @@ Users need to implement a single function to capture the
CF table at startup:
// the collected control flow.
}
+Tracing Stack Depth
+===
+
+With ``-fsanitize-coverage=stack-depth`` the compiler will track how much
+stack space has be
@@ -385,6 +385,49 @@ Users need to implement a single function to capture the
CF table at startup:
// the collected control flow.
}
+Tracing Stack Depth
+===
+
+With ``-fsanitize-coverage=stack-depth`` the compiler will track how much
+stack space has be
@@ -385,6 +385,49 @@ Users need to implement a single function to capture the
CF table at startup:
// the collected control flow.
}
+Tracing Stack Depth
+===
+
+With ``-fsanitize-coverage=stack-depth`` the compiler will track how much
+stack space has be
@@ -2361,6 +2361,13 @@ def fsanitize_coverage_ignorelist : Joined<["-"],
"fsanitize-coverage-ignorelist
HelpText<"Disable sanitizer coverage instrumentation for modules and
functions "
"that match the provided special case list, even the allowed
ones">,
https://github.com/melver commented:
Generally LGTM - but let's also wait for others to comment.
Documentation of this feature is lacking (and afaik also wasn't added in
https://reviews.llvm.org/D36839). Given this will be used in the kernel, some
kind of official documentation might be good t
https://github.com/melver approved this pull request.
https://github.com/llvm/llvm-project/pull/138323
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -2361,6 +2361,13 @@ def fsanitize_coverage_ignorelist : Joined<["-"],
"fsanitize-coverage-ignorelist
HelpText<"Disable sanitizer coverage instrumentation for modules and
functions "
"that match the provided special case list, even the allowed
ones">,
https://github.com/melver edited
https://github.com/llvm/llvm-project/pull/138323
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -1078,22 +1092,44 @@ void
ModuleSanitizerCoverage::InjectCoverageAtBlock(Function &F, BasicBlock &BB,
Store->setNoSanitizeMetadata();
}
if (Options.StackDepth && IsEntryBB && !IsLeafFunc) {
-// Check stack depth. If it's the deepest so far, record it.
Modu
https://github.com/melver requested changes to this pull request.
This is also missing flag and IR tests.
https://github.com/llvm/llvm-project/pull/138323
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/li
https://github.com/melver edited
https://github.com/llvm/llvm-project/pull/138323
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -34,6 +34,7 @@ class SanitizerArgs {
std::vector CoverageIgnorelistFiles;
std::vector BinaryMetadataIgnorelistFiles;
int CoverageFeatures = 0;
+ int StackDepthCallbackMin = 0;
melver wrote:
`CoverageStackDepthCallbackMin`
https://github.com/llvm/llv
https://github.com/melver edited
https://github.com/llvm/llvm-project/pull/137133
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/melver edited
https://github.com/llvm/llvm-project/pull/137133
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/melver edited
https://github.com/llvm/llvm-project/pull/137133
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/melver updated
https://github.com/llvm/llvm-project/pull/137133
>From a8319028f08192ca6140beed7f27a83a829c6d84 Mon Sep 17 00:00:00 2001
From: Marco Elver
Date: Wed, 23 Apr 2025 11:31:25 +0200
Subject: [PATCH 1/2] Thread Safety Analysis: Convert CapabilityExpr::CapExpr
to hol
Author: Marco Elver
Date: 2025-04-30T08:49:15+02:00
New Revision: 4bf93c098c8b04a06f228b05732d691d0ce2babc
URL:
https://github.com/llvm/llvm-project/commit/4bf93c098c8b04a06f228b05732d691d0ce2babc
DIFF:
https://github.com/llvm/llvm-project/commit/4bf93c098c8b04a06f228b05732d691d0ce2babc.diff
L
@@ -388,7 +395,7 @@ class SExprBuilder {
til::LiteralPtr *createVariable(const VarDecl *VD);
// Create placeholder for this: we don't know the VarDecl on construction
yet.
- std::pair
+ std::pair
melver wrote:
I think this code is just more complex tha
@@ -81,26 +81,25 @@ static bool isCalleeArrow(const Expr *E) {
return ME ? ME->isArrow() : false;
}
-static StringRef ClassifyDiagnostic(const CapabilityAttr *A) {
- return A->getName();
-}
-
-static StringRef ClassifyDiagnostic(QualType VDT) {
+static CapabilityExpr makeCa
@@ -235,6 +266,20 @@ class FactSet {
return false;
}
+ std::optional replaceLock(FactManager &FM, iterator It,
+std::unique_ptr Entry) {
+if (It == end())
+ return std::nullopt;
+FactID F = FM.newFact(std::move(Entry));
+
@@ -271,26 +271,32 @@ class CFGWalker {
// translateAttrExpr needs it, but that should be moved too.
class CapabilityExpr {
private:
- /// The capability expression and whether it's negated.
- llvm::PointerIntPair CapExpr;
+ /// The capability expression and flags.
+ llvm::
https://github.com/melver updated
https://github.com/llvm/llvm-project/pull/137133
>From d3324c1023533bf784a3c3c3ef095d07c865e6f9 Mon Sep 17 00:00:00 2001
From: Marco Elver
Date: Wed, 23 Apr 2025 11:31:25 +0200
Subject: [PATCH 1/2] Thread Safety Analysis: Convert CapabilityExpr::CapExpr
to hol
https://github.com/melver updated
https://github.com/llvm/llvm-project/pull/137133
>From d3324c1023533bf784a3c3c3ef095d07c865e6f9 Mon Sep 17 00:00:00 2001
From: Marco Elver
Date: Wed, 23 Apr 2025 11:31:25 +0200
Subject: [PATCH 1/2] Thread Safety Analysis: Convert CapabilityExpr::CapExpr
to hol
melver wrote:
> I think the biggest issue is that removing `const` from `FactEntry` does not
> work. You'll have to undo all those changes and instead create a new
> `FactEntry` for every lock/unlock.
Good catch, reworked this.
PTAL.
https://github.com/llvm/llvm-project/pull/137133
__
@@ -434,6 +434,16 @@ class can be used as a capability. The string argument
specifies the kind of
capability in error messages, e.g. ``"mutex"``. See the ``Container`` example
given above, or the ``Mutex`` class in :ref:`mutexheader`.
+REENTRANT
+-
+
+``REENTRANT``
https://github.com/melver updated
https://github.com/llvm/llvm-project/pull/137133
>From d3324c1023533bf784a3c3c3ef095d07c865e6f9 Mon Sep 17 00:00:00 2001
From: Marco Elver
Date: Wed, 23 Apr 2025 11:31:25 +0200
Subject: [PATCH 1/2] Thread Safety Analysis: Convert CapabilityExpr::CapExpr
to hol
https://github.com/melver updated
https://github.com/llvm/llvm-project/pull/137133
>From d3324c1023533bf784a3c3c3ef095d07c865e6f9 Mon Sep 17 00:00:00 2001
From: Marco Elver
Date: Wed, 23 Apr 2025 11:31:25 +0200
Subject: [PATCH 1/2] Thread Safety Analysis: Convert CapabilityExpr::CapExpr
to hol
@@ -3990,6 +3990,13 @@ def LocksExcluded : InheritableAttr {
let Documentation = [Undocumented];
}
+def ReentrantCapability : InheritableAttr {
+ let Spellings = [Clang<"reentrant_capability">];
+ let Subjects = SubjectList<[Record, TypedefName]>;
+ let Documentation = [U
@@ -1831,15 +1852,15 @@ void BuildLockset::handleCall(const Expr *Exp, const
NamedDecl *D,
assert(!Self);
const auto *TagT = Exp->getType()->getAs();
if (D->hasAttrs() && TagT && Exp->isPRValue()) {
- std::pair Placeholder =
- Analyzer->SxBuilder.crea
@@ -271,26 +271,32 @@ class CFGWalker {
// translateAttrExpr needs it, but that should be moved too.
class CapabilityExpr {
private:
- /// The capability expression and whether it's negated.
- llvm::PointerIntPair CapExpr;
+ /// The capability expression and flags.
+ llvm::
1 - 100 of 194 matches
Mail list logo