https://github.com/melver closed
https://github.com/llvm/llvm-project/pull/155687
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/melver closed
https://github.com/llvm/llvm-project/pull/155883
___
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/155687
Note that ACQUIRED_BEFORE(...) and ACQUIRED_AFTER(...) no longer require
-Wthread-safety-beta.
Follow-up from https://github.com/llvm/llvm-project/pull/152853.
>From da13dc026b2ab9fda09ec0ca6ed91672de3a5737 Mon
melver wrote:
Gentle ping - I want to submit this by end of next week.
Thanks.
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 closed
https://github.com/llvm/llvm-project/pull/155001
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/melver auto_merge_enabled
https://github.com/llvm/llvm-project/pull/155001
___
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/155001
The unrelated code was added in between the comment and what it is meant to
document. Move the comment.
NFC.
>From 74c4a81adefcad934416564faa2df0c4c139ae76 Mon Sep 17 00:00:00 2001
From: Marco Elver
Date: Fri,
https://github.com/melver closed
https://github.com/llvm/llvm-project/pull/152853
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
melver wrote:
A bit of archeology revealed that the feature itself has been stable for a long
time, but the beta flag was used to control rollout in the target codebase at
Google. I think this is just some technical debt and the beta flag should have
been dropped years ago - so in all fairness
melver wrote:
Thanks! Intending to merge this one by end of week.
FWIW, I want to commit this before
https://github.com/llvm/llvm-project/pull/142955 - which uses
`-Wthread-safety-beta` to guard the new features.
https://github.com/llvm/llvm-project/pull/152853
___
https://github.com/melver updated
https://github.com/llvm/llvm-project/pull/142955
>From 309bc5281a0c781a19f361fdd958a715a5eb9148 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:
Dropped the translateCXXNewExpr() patch for now.
> This looks good to me now, but you'll need the current maintainers to sign
> off on it. :-)
Thank you for the review!
https://github.com/llvm/llvm-project/pull/142955
___
cfe-commits m
@@ -7546,6 +7546,15 @@ void testRecursiveAssign() {
f->mu.Unlock();
}
+// A strange pattern that no sane person should write...
+void testStrangePattern(Mutex *&out, int &x) {
melver wrote:
Good point - I've dropped the translateCXXNewExpr() patch for now.
https://github.com/melver updated
https://github.com/llvm/llvm-project/pull/142955
>From dc3e720da86ecee117604f54058036e0701026e2 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 c0ac979fe46fe52a8e7655a63083cbb51b9a1711 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 3d5772cb2e72187cdc6f23411bb76e853f558cf1 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
melver wrote:
Squashed the loop-invariant alias fix, so this should address most comments -
initially thought I'd preserve the history of how we got here, but this seems
cleaner. Also moved the isStaticLocal() fix to the base commit, and the 2nd
commit is now only about translateCXXNewExpr().
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 1a6a416d79f51b44a1fc9beaa29dbbb48c5045ef 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 1a6a416d79f51b44a1fc9beaa29dbbb48c5045ef 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
@@ -6875,6 +6875,34 @@ class PointerGuard {
};
} // namespace Derived_Smart_Pointer
+// Test for capabilities that are heap-allocated and stored in static
variables.
+namespace FunctionStaticVariable {
+struct Data {
+ Mutex mu;
+ int x GUARDED_BY(mu);
+};
+
+void testStati
melver wrote:
Alright, I think this is as far as I can push it. This PR now contains 3
commits just to keep the story clear (happy to squash them if that's better).
Besides the Linux kernel prototype integration, I took this version and tested
it on our internal codebase that has used `-Wthrea
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
https://github.com/melver created
https://github.com/llvm/llvm-project/pull/152853
Both these attributes were introduced in ab1dc2d54db5 ("Thread Safety Analysis:
add support for before/after annotations on mutexes") back in 2015 as "beta"
features.
Anecdotally, we've been using `-Wthread-saf
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
1 - 100 of 218 matches
Mail list logo