martinboehme wrote:
> I also fixed up the other tests to use `getValue/LocForDecl` to be consistent.
That's great -- thanks for doing this! I have always been meaning to do a
cleanup but have never gotten round to it.
https://github.com/llvm/llvm-project/pull/87233
ymand wrote:
I also fixed up the other tests to use `getValue/LocForDecl` to be consistent.
https://github.com/llvm/llvm-project/pull/87233
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://github.com/ymand updated https://github.com/llvm/llvm-project/pull/87233
>From d8d875271bd47b71701143afb06ea654546e2b7c Mon Sep 17 00:00:00 2001
From: Yitzhak Mandelbaum
Date: Mon, 1 Apr 2024 12:13:39 +
Subject: [PATCH 1/4] [clang][dataflow] Refactor `widen` API to be explicit
@@ -975,6 +994,35 @@ TEST_F(WideningTest,
DistinctValuesWithSamePropertiesAreEquivalent) {
});
}
+TEST_F(WideningTest, DistinctValuesWithDifferentPropertiesWidenedToTop) {
+ std::string Code = R"(
+void target(bool Cond) {
+ int *Foo;
+ int i = 0;
+
https://github.com/martinboehme approved this pull request.
https://github.com/llvm/llvm-project/pull/87233
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/martinboehme edited
https://github.com/llvm/llvm-project/pull/87233
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -975,6 +989,35 @@ TEST_F(WideningTest,
DistinctValuesWithSamePropertiesAreEquivalent) {
});
}
+TEST_F(WideningTest, DistinctValuesWithDifferentPropertiesWidenedToTop) {
+ std::string Code = R"(
+void target(bool Cond) {
+ int *Foo;
+ int i = 0;
+
@@ -122,17 +135,19 @@ class Environment {
///
/// `Prev` and `Current` must be assigned to the same storage location in
/// `PrevEnv` and `CurrentEnv`, respectively.
-virtual Value *widen(QualType Type, Value , const Environment
,
-
@@ -805,6 +805,25 @@ class NullPointerAnalysis final
else
JoinedVal.setProperty("is_null", JoinedEnv.makeTopBoolValue());
}
+
+ std::optional widen(QualType Type, Value ,
+ const Environment , Value ,
+
ymand wrote:
Martin, I've addressed all of your comments. PTAL.
https://github.com/llvm/llvm-project/pull/87233
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -975,6 +994,35 @@ TEST_F(WideningTest,
DistinctValuesWithSamePropertiesAreEquivalent) {
});
}
+TEST_F(WideningTest, DistinctValuesWithDifferentPropertiesWidenedToTop) {
+ std::string Code = R"(
+void target(bool Cond) {
+ int *Foo;
+ int i = 0;
+
https://github.com/ymand updated https://github.com/llvm/llvm-project/pull/87233
>From d8d875271bd47b71701143afb06ea654546e2b7c Mon Sep 17 00:00:00 2001
From: Yitzhak Mandelbaum
Date: Mon, 1 Apr 2024 12:13:39 +
Subject: [PATCH 1/3] [clang][dataflow] Refactor `widen` API to be explicit
https://github.com/ymand updated https://github.com/llvm/llvm-project/pull/87233
>From d8d875271bd47b71701143afb06ea654546e2b7c Mon Sep 17 00:00:00 2001
From: Yitzhak Mandelbaum
Date: Mon, 1 Apr 2024 12:13:39 +
Subject: [PATCH 1/2] [clang][dataflow] Refactor `widen` API to be explicit
@@ -975,6 +994,35 @@ TEST_F(WideningTest,
DistinctValuesWithSamePropertiesAreEquivalent) {
});
}
+TEST_F(WideningTest, DistinctValuesWithDifferentPropertiesWidenedToTop) {
+ std::string Code = R"(
+void target(bool Cond) {
+ int *Foo;
+ int i = 0;
+
@@ -975,6 +994,35 @@ TEST_F(WideningTest,
DistinctValuesWithSamePropertiesAreEquivalent) {
});
}
+TEST_F(WideningTest, DistinctValuesWithDifferentPropertiesWidenedToTop) {
+ std::string Code = R"(
+void target(bool Cond) {
+ int *Foo;
+ int i = 0;
+
@@ -805,6 +805,25 @@ class NullPointerAnalysis final
else
JoinedVal.setProperty("is_null", JoinedEnv.makeTopBoolValue());
}
+
+ std::optional widen(QualType Type, Value ,
+ const Environment , Value ,
+
@@ -122,17 +135,19 @@ class Environment {
///
/// `Prev` and `Current` must be assigned to the same storage location in
/// `PrevEnv` and `CurrentEnv`, respectively.
-virtual Value *widen(QualType Type, Value , const Environment
,
-
@@ -805,6 +805,25 @@ class NullPointerAnalysis final
else
JoinedVal.setProperty("is_null", JoinedEnv.makeTopBoolValue());
}
+
+ std::optional widen(QualType Type, Value ,
+ const Environment , Value ,
+
@@ -975,6 +994,35 @@ TEST_F(WideningTest,
DistinctValuesWithSamePropertiesAreEquivalent) {
});
}
+TEST_F(WideningTest, DistinctValuesWithDifferentPropertiesWidenedToTop) {
+ std::string Code = R"(
+void target(bool Cond) {
+ int *Foo;
+ int i = 0;
+
@@ -166,17 +166,20 @@ static Value *joinDistinctValues(QualType Type, Value
,
return JoinedVal;
}
-// When widening does not change `Current`, return value will equal ``.
-static Value (QualType Type, Value ,
- const Environment , Value ,
-
@@ -122,17 +135,19 @@ class Environment {
///
/// `Prev` and `Current` must be assigned to the same storage location in
/// `PrevEnv` and `CurrentEnv`, respectively.
-virtual Value *widen(QualType Type, Value , const Environment
,
-
@@ -975,6 +994,35 @@ TEST_F(WideningTest,
DistinctValuesWithSamePropertiesAreEquivalent) {
});
}
+TEST_F(WideningTest, DistinctValuesWithDifferentPropertiesWidenedToTop) {
+ std::string Code = R"(
+void target(bool Cond) {
+ int *Foo;
+ int i = 0;
+
@@ -975,6 +994,35 @@ TEST_F(WideningTest,
DistinctValuesWithSamePropertiesAreEquivalent) {
});
}
+TEST_F(WideningTest, DistinctValuesWithDifferentPropertiesWidenedToTop) {
+ std::string Code = R"(
+void target(bool Cond) {
+ int *Foo;
+ int i = 0;
+
@@ -97,21 +97,34 @@ class Environment {
const Value , const Environment ,
Value , Environment ) {}
+/// The result of the `widen` operation.
+struct WidenResult {
+ /// Non-null pointer to a potentially widened version
https://github.com/martinboehme requested changes to this pull request.
Nice. This is _much_ clearer!
Mostly nits, the only substantive question I have is how we will migrate
existing overrides.
https://github.com/llvm/llvm-project/pull/87233
___
https://github.com/martinboehme edited
https://github.com/llvm/llvm-project/pull/87233
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/ymand updated https://github.com/llvm/llvm-project/pull/87233
>From d8d875271bd47b71701143afb06ea654546e2b7c Mon Sep 17 00:00:00 2001
From: Yitzhak Mandelbaum
Date: Mon, 1 Apr 2024 12:13:39 +
Subject: [PATCH] [clang][dataflow] Refactor `widen` API to be explicit about
https://github.com/ymand updated https://github.com/llvm/llvm-project/pull/87233
>From b7f63ed7ca3c503f55eccc215f0a66368e2c5e5e Mon Sep 17 00:00:00 2001
From: Yitzhak Mandelbaum
Date: Mon, 1 Apr 2024 12:13:39 +
Subject: [PATCH] [clang][dataflow] Refactor `widen` API to be explicit about
github-actions[bot] wrote:
:warning: C/C++ code formatter, clang-format found issues in your code.
:warning:
You can test this locally with the following command:
``bash
git-clang-format --diff a1a8bb1d3ae9a535526aba9514e87f76e2d040fa
6889df911a11fc5c27149f138176166aef3e1f73 --
llvmbot wrote:
@llvm/pr-subscribers-clang
Author: Yitzhak Mandelbaum (ymand)
Changes
The previous API relied on pointer equality of inputs and outputs to signal
whether a change occured. This was too subtle and led to bugs in practice. It
was also very limiting: the override could not
https://github.com/ymand created https://github.com/llvm/llvm-project/pull/87233
The previous API relied on pointer equality of inputs and outputs to signal
whether a change occured. This was too subtle and led to bugs in practice. It
was also very limiting: the override could not return an
31 matches
Mail list logo