=?utf-8?q?G=C3=A1bor?= Spaits,=?utf-8?q?G=C3=A1bor?= Spaits,
=?utf-8?q?G=C3=A1bor?= Spaits
Message-ID:
In-Reply-To:
https://github.com/steakhal approved this pull request.
https://github.com/llvm/llvm-project/pull/68691
___
cfe-commits mailing list
c
=?utf-8?q?Gábor?= Spaits,=?utf-8?q?Gábor?= Spaits,
=?utf-8?q?Gábor?= Spaits
Message-ID:
In-Reply-To:
https://github.com/DonatNagyE closed
https://github.com/llvm/llvm-project/pull/68691
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://l
https://github.com/spaits created
https://github.com/llvm/llvm-project/pull/68691
In the following code
`
int main() {
struct Wrapper {char c; int &ref; };
Wrapper w = {.c = 'a', .ref = *(int *)0 };
w.ref = 1;
}`
The clang static analyzer will produce the following warnings and note
https://github.com/spaits edited https://github.com/llvm/llvm-project/pull/68691
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/spaits edited https://github.com/llvm/llvm-project/pull/68691
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/spaits ready_for_review
https://github.com/llvm/llvm-project/pull/68691
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
llvmbot wrote:
@llvm/pr-subscribers-clang
Author: Gábor Spaits (spaits)
Changes
In the following code:
```cpp
int main() {
struct Wrapper {char c; int &ref; };
Wrapper w = {.c = 'a', .ref = *(int *)0 };
w.ref = 1;
}
```
The clang static analyzer will produce the following warn
https://github.com/spaits edited https://github.com/llvm/llvm-project/pull/68691
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/spaits updated
https://github.com/llvm/llvm-project/pull/68691
From bb9cb77cab7b073d45c0b998c926a0b60a75a35e Mon Sep 17 00:00:00 2001
From: Gabor Spaits
Date: Tue, 10 Oct 2023 13:40:05 +0200
Subject: [PATCH 1/2] [analyzer] Fix note for member reference
---
.../Core/BugRepor
@@ -41,3 +41,34 @@ int testRefToNullPtr2() {
return *p2; //expected-warning {{Dereference of null pointer}}
// expected-note@-1{{Dereference of null pointer}}
}
+
+void testMemberNullPointerDeref() {
+ struct Wrapper {char c; int *ptr; };
+ W
https://github.com/DonatNagyE approved this pull request.
LGTM; my only suggestions are comment / naming clarifications.
https://github.com/llvm/llvm-project/pull/68691
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-
@@ -132,6 +132,18 @@ const Expr *bugreporter::getDerefExpr(const Stmt *S) {
}
// Pattern match for a few useful cases: a[0], p->f, *p etc.
else if (const auto *ME = dyn_cast(E)) {
+ // This handles the case when the dereferencing of a member reference
+ //
https://github.com/DonatNagyE edited
https://github.com/llvm/llvm-project/pull/68691
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -157,26 +169,43 @@ const Expr *bugreporter::getDerefExpr(const Stmt *S) {
return E;
}
+static const VarDecl *getVarDeclForExpression(const Expr *E) {
+ if (const auto *DR = dyn_cast(E))
+return dyn_cast(DR->getDecl());
+ return nullptr;
+}
+
static const MemRegion
@@ -132,6 +132,18 @@ const Expr *bugreporter::getDerefExpr(const Stmt *S) {
}
// Pattern match for a few useful cases: a[0], p->f, *p etc.
else if (const auto *ME = dyn_cast(E)) {
+ // This handles the case when the dereferencing of a member reference
+ //
https://github.com/spaits updated
https://github.com/llvm/llvm-project/pull/68691
From bb9cb77cab7b073d45c0b998c926a0b60a75a35e Mon Sep 17 00:00:00 2001
From: Gabor Spaits
Date: Tue, 10 Oct 2023 13:40:05 +0200
Subject: [PATCH 1/3] [analyzer] Fix note for member reference
---
.../Core/BugRepor
https://github.com/spaits updated
https://github.com/llvm/llvm-project/pull/68691
From bb9cb77cab7b073d45c0b998c926a0b60a75a35e Mon Sep 17 00:00:00 2001
From: Gabor Spaits
Date: Tue, 10 Oct 2023 13:40:05 +0200
Subject: [PATCH 1/4] [analyzer] Fix note for member reference
---
.../Core/BugRepor
https://github.com/spaits updated
https://github.com/llvm/llvm-project/pull/68691
From bb9cb77cab7b073d45c0b998c926a0b60a75a35e Mon Sep 17 00:00:00 2001
From: Gabor Spaits
Date: Tue, 10 Oct 2023 13:40:05 +0200
Subject: [PATCH 1/5] [analyzer] Fix note for member reference
---
.../Core/BugRepor
https://github.com/spaits updated
https://github.com/llvm/llvm-project/pull/68691
From bb9cb77cab7b073d45c0b998c926a0b60a75a35e Mon Sep 17 00:00:00 2001
From: Gabor Spaits
Date: Tue, 10 Oct 2023 13:40:05 +0200
Subject: [PATCH 1/6] [analyzer] Fix note for member reference
---
.../Core/BugRepor
19 matches
Mail list logo