https://github.com/necto created
https://github.com/llvm/llvm-project/pull/107537
Bind the array member to the compound region associated with the initializer
list, e.g.:
class C {
int arr[2];
C() : arr{1, 2} {}
};
C c;
This change enables correct values in `c.arr[0]`
https://github.com/necto updated
https://github.com/llvm/llvm-project/pull/107537
>From 63c856732aeda977786534d66597d0aba12cb0d4 Mon Sep 17 00:00:00 2001
From: Arseniy Zaostrovnykh
Date: Tue, 3 Sep 2024 18:01:02 +0200
Subject: [PATCH 1/2] [analyzer] Model constructor initializer for an array
m
necto wrote:
> LGTM. FYI "modelled" should contain only 1 "l" if I'm not mistaken. Also llvm
> style suggests capitalizing and punctuating comments. None of these are
> blockers.
fixed eecf42ac8fc4
https://github.com/llvm/llvm-project/pull/107537
__
https://github.com/necto edited https://github.com/llvm/llvm-project/pull/100745
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -369,24 +393,48 @@ void StackAddrEscapeChecker::checkEndFunction(const
ReturnStmt *RS,
const auto *ReferrerStackSpace =
ReferrerMemSpace->getAs();
+
if (!ReferrerStackSpace)
return false;
- if (ReferredMemSpace->getStackFrame() == Pop
https://github.com/necto updated
https://github.com/llvm/llvm-project/pull/106048
>From 7d5ae515f7727de98e7e8ce2f259e579a1f24463 Mon Sep 17 00:00:00 2001
From: Arseniy Zaostrovnykh
Date: Tue, 20 Aug 2024 17:31:11 +0200
Subject: [PATCH 1/7] [analyzer] Report violations of the "returns_nonnull"
@@ -588,8 +588,8 @@ Warns when a null pointer is passed to a pointer which has
a _Nonnull type.
.. _nullability-NullReturnedFromNonnull:
-nullability.NullReturnedFromNonnull (ObjC)
-""
+nullability.NullReturnedFromNonnull
+
https://github.com/necto updated
https://github.com/llvm/llvm-project/pull/106048
>From 7d5ae515f7727de98e7e8ce2f259e579a1f24463 Mon Sep 17 00:00:00 2001
From: Arseniy Zaostrovnykh
Date: Tue, 20 Aug 2024 17:31:11 +0200
Subject: [PATCH 1/8] [analyzer] Report violations of the "returns_nonnull"
@@ -51,3 +54,15 @@ int *cannot_return_null() {
__attribute__((returns_nonnull)) int *passthrough(int *p) {
return p; // no-warning: we have no evidence that `p` is null, i.e.,
violating the contract
}
+
+__attribute__((noreturn))
+void exit(int);
necto wrote
https://github.com/necto updated
https://github.com/llvm/llvm-project/pull/105648
>From 991f176c5545fedae2ba8b5c1b357734abe68ac7 Mon Sep 17 00:00:00 2001
From: Arseniy Zaostrovnykh
Date: Tue, 20 Aug 2024 11:16:10 +0200
Subject: [PATCH 1/2] [analyzer] Detect leaks on top-level via output params,
@@ -369,24 +393,48 @@ void StackAddrEscapeChecker::checkEndFunction(const
ReturnStmt *RS,
const auto *ReferrerStackSpace =
ReferrerMemSpace->getAs();
+
if (!ReferrerStackSpace)
return false;
- if (ReferredMemSpace->getStackFrame() == Pop
https://github.com/necto edited https://github.com/llvm/llvm-project/pull/106048
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/necto updated
https://github.com/llvm/llvm-project/pull/106048
>From 7d5ae515f7727de98e7e8ce2f259e579a1f24463 Mon Sep 17 00:00:00 2001
From: Arseniy Zaostrovnykh
Date: Tue, 20 Aug 2024 17:31:11 +0200
Subject: [PATCH 1/8] [analyzer] Report violations of the "returns_nonnull"
@@ -374,13 +395,13 @@ void StackAddrEscapeChecker::checkEndFunction(const
ReturnStmt *RS,
// Generate a report for this bug.
const StringRef CommonSuffix =
-"upon returning to the caller. This will be a dangling reference";
+" upon returning to the ca
https://github.com/necto edited https://github.com/llvm/llvm-project/pull/105652
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/necto edited https://github.com/llvm/llvm-project/pull/105652
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/necto updated
https://github.com/llvm/llvm-project/pull/105648
>From 991f176c5545fedae2ba8b5c1b357734abe68ac7 Mon Sep 17 00:00:00 2001
From: Arseniy Zaostrovnykh
Date: Tue, 20 Aug 2024 11:16:10 +0200
Subject: [PATCH 1/3] [analyzer] Detect leaks on top-level via output params,
@@ -424,6 +481,9 @@ void StackAddrEscapeChecker::checkEndFunction(const
ReturnStmt *RS,
for (const auto &P : Cb.V) {
const MemRegion *Referrer = P.first->getBaseRegion();
const MemRegion *Referred = P.second;
+if (Cb.ExcludedRegions.contains(getOriginBaseRegion(R
https://github.com/necto updated
https://github.com/llvm/llvm-project/pull/105648
>From 991f176c5545fedae2ba8b5c1b357734abe68ac7 Mon Sep 17 00:00:00 2001
From: Arseniy Zaostrovnykh
Date: Tue, 20 Aug 2024 11:16:10 +0200
Subject: [PATCH 1/4] [analyzer] Detect leaks on top-level via output params,
@@ -305,6 +305,14 @@ static const MemSpaceRegion
*getStackOrGlobalSpaceRegion(const MemRegion *R) {
return nullptr;
}
+const MemRegion *getOriginBaseRegion(const MemRegion *Referrer) {
+ Referrer = Referrer->getBaseRegion();
+ while (const auto *SymReg = dyn_cast(Referrer
https://github.com/necto updated
https://github.com/llvm/llvm-project/pull/105648
>From 991f176c5545fedae2ba8b5c1b357734abe68ac7 Mon Sep 17 00:00:00 2001
From: Arseniy Zaostrovnykh
Date: Tue, 20 Aug 2024 11:16:10 +0200
Subject: [PATCH 1/5] [analyzer] Detect leaks on top-level via output params,
@@ -348,12 +357,27 @@ void StackAddrEscapeChecker::checkEndFunction(const
ReturnStmt *RS,
ExplodedNode *Node = Ctx.getPredecessor();
+ bool ExitingTopFrame =
+ Ctx.getPredecessor()->getLocationContext()->inTopFrame();
+
+ if (ExitingTopFrame && Node->getLocation().g
https://github.com/necto updated
https://github.com/llvm/llvm-project/pull/105648
>From 991f176c5545fedae2ba8b5c1b357734abe68ac7 Mon Sep 17 00:00:00 2001
From: Arseniy Zaostrovnykh
Date: Tue, 20 Aug 2024 11:16:10 +0200
Subject: [PATCH 1/6] [analyzer] Detect leaks on top-level via output params,
https://github.com/necto created
https://github.com/llvm/llvm-project/pull/106232
This dump, if it is ever executed, is not actionable by the user and might
produce unwanted noise in the stderr.
The original intention behind this dump, to provide maximum information in an
unexpected situation
@@ -297,20 +314,31 @@ std::optional printReferrer(const MemRegion
*Referrer) {
return "global";
assert(isa(Space));
return "stack";
- }(Referrer->getMemorySpace());
-
- // We should really only have VarRegions here.
- // Anything else is really surprising, and
https://github.com/necto created
https://github.com/llvm/llvm-project/pull/106240
If a mutex interface is split in inheritance chain, e.g. struct mutex has
`unlock` and inherits `lock` from __mutex_base then calls m.lock() and
m.unlock() have different "this" targets: m and the __mutex_base of
https://github.com/necto updated
https://github.com/llvm/llvm-project/pull/106240
>From 0c86e46516466f9513652a04ba87aa2a018ff6b8 Mon Sep 17 00:00:00 2001
From: Arseniy Zaostrovnykh
Date: Tue, 27 Aug 2024 17:52:25 +0200
Subject: [PATCH 1/2] [analyzer] Fix false positive for mutexes inheriting
m
https://github.com/necto updated
https://github.com/llvm/llvm-project/pull/106240
>From 0c86e46516466f9513652a04ba87aa2a018ff6b8 Mon Sep 17 00:00:00 2001
From: Arseniy Zaostrovnykh
Date: Tue, 27 Aug 2024 17:52:25 +0200
Subject: [PATCH 1/3] [analyzer] Fix false positive for mutexes inheriting
m
necto wrote:
> Uh that FN seems really bad. Have you measured this change? Can we relax the
> canonicalization to only unwrap base class regions, or only apply to classes
> within the stdlib?
relaxed in 744272e
https://github.com/llvm/llvm-project/pull/106240
_
https://github.com/necto updated
https://github.com/llvm/llvm-project/pull/106240
>From 0c86e46516466f9513652a04ba87aa2a018ff6b8 Mon Sep 17 00:00:00 2001
From: Arseniy Zaostrovnykh
Date: Tue, 27 Aug 2024 17:52:25 +0200
Subject: [PATCH 1/6] [analyzer] Fix false positive for mutexes inheriting
m
necto wrote:
> Could you also add this test case?
>
> ```c++
> ```
>
> Or is it already implied by other tests?
My first test
``` C++
void no_false_positive_gh_104241() {
std::mutex m;
m.lock();
// If inheritance not handled properly, this unlock might not match the lock
// above beca
https://github.com/necto updated
https://github.com/llvm/llvm-project/pull/106240
>From 0c86e46516466f9513652a04ba87aa2a018ff6b8 Mon Sep 17 00:00:00 2001
From: Arseniy Zaostrovnykh
Date: Tue, 27 Aug 2024 17:52:25 +0200
Subject: [PATCH 1/7] [analyzer] Fix false positive for mutexes inheriting
m
https://github.com/necto updated
https://github.com/llvm/llvm-project/pull/106240
>From 0c86e46516466f9513652a04ba87aa2a018ff6b8 Mon Sep 17 00:00:00 2001
From: Arseniy Zaostrovnykh
Date: Tue, 27 Aug 2024 17:52:25 +0200
Subject: [PATCH 1/8] [analyzer] Fix false positive for mutexes inheriting
m
necto wrote:
@steakhal I added a fix for multiple-inheritance fn, please take another look
https://github.com/llvm/llvm-project/pull/106240
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-comm
https://github.com/necto updated
https://github.com/llvm/llvm-project/pull/106240
>From 0c86e46516466f9513652a04ba87aa2a018ff6b8 Mon Sep 17 00:00:00 2001
From: Arseniy Zaostrovnykh
Date: Tue, 27 Aug 2024 17:52:25 +0200
Subject: [PATCH 1/9] [analyzer] Fix false positive for mutexes inheriting
m
https://github.com/necto updated
https://github.com/llvm/llvm-project/pull/106240
>From 0c86e46516466f9513652a04ba87aa2a018ff6b8 Mon Sep 17 00:00:00 2001
From: Arseniy Zaostrovnykh
Date: Tue, 27 Aug 2024 17:52:25 +0200
Subject: [PATCH 01/10] [analyzer] Fix false positive for mutexes inheriting
@@ -241,10 +241,14 @@ BlockInCriticalSectionChecker::checkDescriptorMatch(const
CallEvent &Call,
return std::nullopt;
}
-static const MemRegion *skipBaseClassRegion(const MemRegion *Reg) {
- while (const auto *BaseClassRegion = dyn_cast(Reg)) {
+static const MemRegion *ski
https://github.com/necto created
https://github.com/llvm/llvm-project/pull/106568
As reported in
https://github.com/llvm/llvm-project/pull/105648#issuecomment-2317144635 commit
08ad8dc7154bf3ab79f750e6d5fb7df597c7601a
introduced a nullptr dereference in the case when store contains a binding t
necto wrote:
> Hello,
>
> The following starts crashing with this patch:
>
> ```
> clang -cc1 -analyze -analyzer-checker=core bbi-98571.c
> ```
>
> Result:
>
> ```
> (...)
> ```
Thank you for the report!
Here is the fix: https://github.com/llvm/llvm-project/pull/106568
https://github.com/ll
https://github.com/necto updated
https://github.com/llvm/llvm-project/pull/106568
>From 71aae8d0cc96d389da95c2231b1145b7ffeb2132 Mon Sep 17 00:00:00 2001
From: Arseniy Zaostrovnykh
Date: Thu, 29 Aug 2024 16:39:12 +0200
Subject: [PATCH 1/2] [analyzer] Fix nullptr dereference for symbols from
po
https://github.com/necto created
https://github.com/llvm/llvm-project/pull/107003
Assigning to a pointer parameter does not leak the stack address because it
stays within the function and is not shared with the caller.
Previous implementation reported any association of a pointer parameter wit
https://github.com/necto updated
https://github.com/llvm/llvm-project/pull/107003
>From da5671efccd0ba56a0dd983b04d1f798c5c35d0d Mon Sep 17 00:00:00 2001
From: Arseniy Zaostrovnykh
Date: Mon, 2 Sep 2024 17:13:14 +0200
Subject: [PATCH 1/2] [analyzer] Fix false positive for stack-addr leak on
si
@@ -791,3 +791,30 @@ void global_ptr_to_ptr() {
*global_pp = nullptr;
}
} // namespace leaking_via_indirect_global_invalidated
+
+namespace not_leaking_via_simple_ptr {
+void top(const char *p) {
necto wrote:
I am not sure what you are referring to by the "r
@@ -791,3 +791,58 @@ void global_ptr_to_ptr() {
*global_pp = nullptr;
}
} // namespace leaking_via_indirect_global_invalidated
+
+namespace not_leaking_via_simple_ptr {
+void simple_ptr(const char *p) {
+ char tmp;
+ p = &tmp; // no-warning
+}
+
+void ref_ptr(const char *&p
https://github.com/necto edited https://github.com/llvm/llvm-project/pull/107003
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/necto created https://github.com/llvm/llvm-project/pull/92266
None
>From eeb24ddbf261fd7667dd05feee14637bc379d182 Mon Sep 17 00:00:00 2001
From: Arseniy Zaostrovnykh
Date: Wed, 15 May 2024 16:02:07 +0200
Subject: [PATCH] Fix CXXNewExpr end source location for 'new struct S'
https://github.com/necto edited https://github.com/llvm/llvm-project/pull/92266
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/necto edited https://github.com/llvm/llvm-project/pull/92266
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
necto wrote:
Disclaimer: I've never touched the Clang parser before, so the fix might not be
in the right place. Please advise.
https://github.com/llvm/llvm-project/pull/92266
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.
necto wrote:
The invalid end location affects the CSA diagnostics, as you can [see on
CE](https://compiler-explorer.com/#z:OYLghAFBqd5QCxAYwPYBMCmBRdBLAF1QCcAaPECAMzwBtMA7AQwFtMQByARg9KtQYEAysib0QXACx8BBAKoBnTAAUAHpwAMvAFYTStJg1DIApACYAQuYukl9ZATwDKjdAGFUtAK4sGe1wAyeAyYAHI%2BAEaYxCDSAA6oCoRODB7e
https://github.com/necto edited https://github.com/llvm/llvm-project/pull/92266
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/necto edited https://github.com/llvm/llvm-project/pull/92266
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/necto updated https://github.com/llvm/llvm-project/pull/92266
>From eeb24ddbf261fd7667dd05feee14637bc379d182 Mon Sep 17 00:00:00 2001
From: Arseniy Zaostrovnykh
Date: Wed, 15 May 2024 16:02:07 +0200
Subject: [PATCH 1/2] Fix CXXNewExpr end source location for 'new struct S'
--
https://github.com/necto updated https://github.com/llvm/llvm-project/pull/92266
>From eeb24ddbf261fd7667dd05feee14637bc379d182 Mon Sep 17 00:00:00 2001
From: Arseniy Zaostrovnykh
Date: Wed, 15 May 2024 16:02:07 +0200
Subject: [PATCH 1/3] Fix CXXNewExpr end source location for 'new struct S'
--
@@ -0,0 +1,5 @@
+// RUN: %clang_cc1 -ast-dump %s 2>&1 | FileCheck %s
necto wrote:
thanks for the pointer, moved!
https://github.com/llvm/llvm-project/pull/92266
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
necto wrote:
> `clang-tidy/checkers/modernize/make-unique.cpp` is failing for whatever
> reason. Otherwise LGTM.
Indeed, turns out this PR fixes #35300
https://github.com/llvm/llvm-project/pull/92266
___
cfe-commits mailing list
cfe-commits@lists.ll
https://github.com/necto updated https://github.com/llvm/llvm-project/pull/92266
>From eeb24ddbf261fd7667dd05feee14637bc379d182 Mon Sep 17 00:00:00 2001
From: Arseniy Zaostrovnykh
Date: Wed, 15 May 2024 16:02:07 +0200
Subject: [PATCH 1/3] Fix CXXNewExpr end source location for 'new struct S'
--
https://github.com/necto updated https://github.com/llvm/llvm-project/pull/92266
>From eeb24ddbf261fd7667dd05feee14637bc379d182 Mon Sep 17 00:00:00 2001
From: Arseniy Zaostrovnykh
Date: Wed, 15 May 2024 16:02:07 +0200
Subject: [PATCH 1/4] Fix CXXNewExpr end source location for 'new struct S'
--
@@ -583,3 +583,8 @@ void NonADLCall3() {
f(x);
}
} // namespace test_adl_call_three
+
necto wrote:
Done
https://github.com/llvm/llvm-project/pull/92266
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https
https://github.com/necto created
https://github.com/llvm/llvm-project/pull/105648
Note, I prepared this PR to be rebased and merged with three commits that are
self-sufficient and build on each other.
Fix some false negatives of StackAddrEscapeChecker:
- Output parameters
```
void top(int
https://github.com/necto edited https://github.com/llvm/llvm-project/pull/105648
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/necto edited https://github.com/llvm/llvm-project/pull/105648
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/necto converted_to_draft
https://github.com/llvm/llvm-project/pull/105648
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
necto wrote:
It turns out that you cannot rebase&merge in llvm-project repo, so I'll create
two more PRs stacked PRs - one per commit
https://github.com/llvm/llvm-project/pull/105648
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lis
https://github.com/necto updated
https://github.com/llvm/llvm-project/pull/105648
>From db68dcfba96bfbf9367ba4159b6bf179c8c56f4f Mon Sep 17 00:00:00 2001
From: Arseniy Zaostrovnykh
Date: Tue, 20 Aug 2024 10:26:38 +0200
Subject: [PATCH 1/3] [analyzer] [NFC] Add tests for and refactor
StackAddrE
https://github.com/necto created
https://github.com/llvm/llvm-project/pull/105652
These tests and refactoring are preparatory for the upcoming changes: detection
of the indirect leak via global variables and output parameters.
CPP-4734
---
This is 1 of three commits constituting
https:/
https://github.com/necto edited https://github.com/llvm/llvm-project/pull/105652
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/necto created
https://github.com/llvm/llvm-project/pull/105653
At this point, only functions called from other functions (i.e., not
top-level) are covered. Top-level functions have a different exit
sequence and will be handled by a subsequent change.
CPP-4734
---
This i
https://github.com/necto converted_to_draft
https://github.com/llvm/llvm-project/pull/105653
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/necto edited https://github.com/llvm/llvm-project/pull/105648
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
necto wrote:
> It turns out that you cannot rebase&merge in llvm-project repo, so I'll
> create two more PRs stacked PRs - one per commit
Here are the two PRs that promote the first two commits of this branch:
https://github.com/llvm/llvm-project/pull/105652 and
https://github.com/llvm/llvm-p
@@ -297,20 +314,29 @@ std::optional printReferrer(const MemRegion
*Referrer) {
return "global";
assert(isa(Space));
return "stack";
- }(Referrer->getMemorySpace());
-
- // We should really only have VarRegions here.
- // Anything else is really surprising, and
https://github.com/necto updated
https://github.com/llvm/llvm-project/pull/105653
>From db68dcfba96bfbf9367ba4159b6bf179c8c56f4f Mon Sep 17 00:00:00 2001
From: Arseniy Zaostrovnykh
Date: Tue, 20 Aug 2024 10:26:38 +0200
Subject: [PATCH 1/4] [analyzer] [NFC] Add tests for and refactor
StackAddrE
@@ -297,20 +314,29 @@ std::optional printReferrer(const MemRegion
*Referrer) {
return "global";
assert(isa(Space));
return "stack";
- }(Referrer->getMemorySpace());
-
- // We should really only have VarRegions here.
- // Anything else is really surprising, and
https://github.com/necto updated
https://github.com/llvm/llvm-project/pull/105648
>From db68dcfba96bfbf9367ba4159b6bf179c8c56f4f Mon Sep 17 00:00:00 2001
From: Arseniy Zaostrovnykh
Date: Tue, 20 Aug 2024 10:26:38 +0200
Subject: [PATCH 1/5] [analyzer] [NFC] Add tests for and refactor
StackAddrE
@@ -297,20 +314,29 @@ std::optional printReferrer(const MemRegion
*Referrer) {
return "global";
assert(isa(Space));
return "stack";
- }(Referrer->getMemorySpace());
-
- // We should really only have VarRegions here.
- // Anything else is really surprising, and
https://github.com/necto updated
https://github.com/llvm/llvm-project/pull/105648
>From db68dcfba96bfbf9367ba4159b6bf179c8c56f4f Mon Sep 17 00:00:00 2001
From: Arseniy Zaostrovnykh
Date: Tue, 20 Aug 2024 10:26:38 +0200
Subject: [PATCH 1/6] [analyzer] [NFC] Add tests for and refactor
StackAddrE
https://github.com/necto updated
https://github.com/llvm/llvm-project/pull/105653
>From db68dcfba96bfbf9367ba4159b6bf179c8c56f4f Mon Sep 17 00:00:00 2001
From: Arseniy Zaostrovnykh
Date: Tue, 20 Aug 2024 10:26:38 +0200
Subject: [PATCH 1/6] [analyzer] [NFC] Add tests for and refactor
StackAddrE
@@ -297,20 +314,29 @@ std::optional printReferrer(const MemRegion
*Referrer) {
return "global";
assert(isa(Space));
return "stack";
- }(Referrer->getMemorySpace());
-
- // We should really only have VarRegions here.
- // Anything else is really surprising, and
https://github.com/necto updated
https://github.com/llvm/llvm-project/pull/105653
>From db68dcfba96bfbf9367ba4159b6bf179c8c56f4f Mon Sep 17 00:00:00 2001
From: Arseniy Zaostrovnykh
Date: Tue, 20 Aug 2024 10:26:38 +0200
Subject: [PATCH 1/7] [analyzer] [NFC] Add tests for and refactor
StackAddrE
@@ -161,3 +164,619 @@ C make1() {
void test_copy_elision() {
C c1 = make1();
}
+
+namespace leaking_via_direct_pointer {
+void* returned_direct_pointer_top() {
+ int local = 42;
+ int* p = &local;
+ return p; // expected-warning{{associated with local variable 'local'
ret
https://github.com/necto edited https://github.com/llvm/llvm-project/pull/105653
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/necto created
https://github.com/llvm/llvm-project/pull/106048
Make sure code respects the GNU-extension __attribute__((returns_nonnull)).
Extend the NullabilityChecker to check that a function returns_nonnull does not
return a nullptr.
CPP-4741
>From 2618fc762a4913eaf3dd3
https://github.com/necto edited https://github.com/llvm/llvm-project/pull/106048
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/necto updated
https://github.com/llvm/llvm-project/pull/105652
>From db68dcfba96bfbf9367ba4159b6bf179c8c56f4f Mon Sep 17 00:00:00 2001
From: Arseniy Zaostrovnykh
Date: Tue, 20 Aug 2024 10:26:38 +0200
Subject: [PATCH] [analyzer] [NFC] Add tests for and refactor
StackAddrEscap
https://github.com/necto updated
https://github.com/llvm/llvm-project/pull/105653
>From 902e1d63b436db3ca9e21b022e821a0182bf992c Mon Sep 17 00:00:00 2001
From: Arseniy Zaostrovnykh
Date: Tue, 20 Aug 2024 10:53:25 +0200
Subject: [PATCH] [analyzer] Detect leak of a stack address through output
a
https://github.com/necto updated
https://github.com/llvm/llvm-project/pull/105653
>From 902e1d63b436db3ca9e21b022e821a0182bf992c Mon Sep 17 00:00:00 2001
From: Arseniy Zaostrovnykh
Date: Tue, 20 Aug 2024 10:53:25 +0200
Subject: [PATCH] [analyzer] Detect leak of a stack address through output
a
https://github.com/necto ready_for_review
https://github.com/llvm/llvm-project/pull/105653
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/necto updated
https://github.com/llvm/llvm-project/pull/105648
>From 902e1d63b436db3ca9e21b022e821a0182bf992c Mon Sep 17 00:00:00 2001
From: Arseniy Zaostrovnykh
Date: Tue, 20 Aug 2024 10:53:25 +0200
Subject: [PATCH 1/2] [analyzer] Detect leak of a stack address through outpu
necto wrote:
@steakhal I've rebased atop of `main` and squashed. CI is green. Could you,
please, merge this PR (following
https://github.com/llvm/llvm-project/pull/105652)?
https://github.com/llvm/llvm-project/pull/105653
___
cfe-commits mailing list
https://github.com/necto updated
https://github.com/llvm/llvm-project/pull/105648
>From 991f176c5545fedae2ba8b5c1b357734abe68ac7 Mon Sep 17 00:00:00 2001
From: Arseniy Zaostrovnykh
Date: Tue, 20 Aug 2024 11:16:10 +0200
Subject: [PATCH] [analyzer] Detect leaks on top-level via output params,
in
https://github.com/necto ready_for_review
https://github.com/llvm/llvm-project/pull/105648
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
necto wrote:
> Please ping me when this commit is in a clean state that can be reviewed
> (e.g. updates on earlier commits are incorporated). Thanks!
@NagyDonat , the earlier commits are now merged and I rebased this PR. Feel
free to have a look
https://github.com/llvm/llvm-project/pull/10564
https://github.com/necto updated
https://github.com/llvm/llvm-project/pull/106048
>From 7d5ae515f7727de98e7e8ce2f259e579a1f24463 Mon Sep 17 00:00:00 2001
From: Arseniy Zaostrovnykh
Date: Tue, 20 Aug 2024 17:31:11 +0200
Subject: [PATCH] [analyzer] Report violations of the "returns_nonnull"
attr
https://github.com/necto updated
https://github.com/llvm/llvm-project/pull/106048
>From 7d5ae515f7727de98e7e8ce2f259e579a1f24463 Mon Sep 17 00:00:00 2001
From: Arseniy Zaostrovnykh
Date: Tue, 20 Aug 2024 17:31:11 +0200
Subject: [PATCH 1/2] [analyzer] Report violations of the "returns_nonnull"
@@ -10,3 +12,42 @@ void block_arity_mismatch() {
void(^b)() = ^(int a, int b) { };
b(1); // no-crash expected-warning {{Block taking 2 arguments is called
with fewer (1)}}
}
+
+int *nonnull_return_annotation_indirect() __attribute__((returns_nonnull));
+int *nonnull_retur
https://github.com/necto updated
https://github.com/llvm/llvm-project/pull/106048
>From 7d5ae515f7727de98e7e8ce2f259e579a1f24463 Mon Sep 17 00:00:00 2001
From: Arseniy Zaostrovnykh
Date: Tue, 20 Aug 2024 17:31:11 +0200
Subject: [PATCH 1/5] [analyzer] Report violations of the "returns_nonnull"
@@ -1,4 +1,6 @@
-// RUN: %clang_analyze_cc1 -fblocks -analyzer-checker=core,nullability
-Wno-deprecated-non-prototype -verify %s
+// RUN: %clang_analyze_cc1 -fblocks
-analyzer-checker=core,nullability,debug.ExprInspection
-Wno-deprecated-non-prototype -verify %s
---
@@ -10,3 +12,42 @@ void block_arity_mismatch() {
void(^b)() = ^(int a, int b) { };
b(1); // no-crash expected-warning {{Block taking 2 arguments is called
with fewer (1)}}
}
+
+int *nonnull_return_annotation_indirect() __attribute__((returns_nonnull));
+int *nonnull_retur
@@ -692,6 +692,14 @@ void NullabilityChecker::checkPreStmt(const ReturnStmt *S,
NullConstraint Nullness = getNullConstraint(*RetSVal, State);
Nullability RequiredNullability = getNullabilityAnnotation(RequiredRetType);
+ if (const auto *FunDecl = C.getLocationContext()->g
1 - 100 of 230 matches
Mail list logo