summaryrefslogtreecommitdiff
path: root/clang/unittests
diff options
context:
space:
mode:
authorYitzhak Mandelbaum <yitzhakm@google.com>2023-04-14 21:00:24 +0000
committerYitzhak Mandelbaum <yitzhakm@google.com>2023-04-17 18:03:58 +0000
commit09b462ef8539433f56d1a6d2cc807db9a56072e6 (patch)
treea22faef51506fdeb18c0931a4dbe28a208fd4a13 /clang/unittests
parentcd22e0dc9d0b5487eb2d54dd028a2aa439627159 (diff)
downloadllvm-09b462ef8539433f56d1a6d2cc807db9a56072e6.tar.gz
[clang][dataflow] Drop optional model's dependency on libc++ internals.
Adjusts the matchers in the optional model to avoid dependency on internal implementation details of libc++'s `std::optional`. In the process, factors out the code to check the name of these types so that it's shared throughout. Differential Revision: https://reviews.llvm.org/D148377
Diffstat (limited to 'clang/unittests')
-rw-r--r--clang/unittests/Analysis/FlowSensitive/UncheckedOptionalAccessModelTest.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/clang/unittests/Analysis/FlowSensitive/UncheckedOptionalAccessModelTest.cpp b/clang/unittests/Analysis/FlowSensitive/UncheckedOptionalAccessModelTest.cpp
index 8aba91566d4d..a9d2357a57fb 100644
--- a/clang/unittests/Analysis/FlowSensitive/UncheckedOptionalAccessModelTest.cpp
+++ b/clang/unittests/Analysis/FlowSensitive/UncheckedOptionalAccessModelTest.cpp
@@ -1784,8 +1784,7 @@ TEST_P(UncheckedOptionalAccessTest, ValueOr) {
)");
}
-TEST_P(UncheckedOptionalAccessTest, ValueOrComparison) {
- // Pointers.
+TEST_P(UncheckedOptionalAccessTest, ValueOrComparisonPointers) {
ExpectDiagnosticsFor(
R"code(
#include "unchecked_optional_access_test.h"
@@ -1798,8 +1797,9 @@ TEST_P(UncheckedOptionalAccessTest, ValueOrComparison) {
}
}
)code");
+}
- // Integers.
+TEST_P(UncheckedOptionalAccessTest, ValueOrComparisonIntegers) {
ExpectDiagnosticsFor(
R"code(
#include "unchecked_optional_access_test.h"
@@ -1812,8 +1812,9 @@ TEST_P(UncheckedOptionalAccessTest, ValueOrComparison) {
}
}
)code");
+}
- // Strings.
+TEST_P(UncheckedOptionalAccessTest, ValueOrComparisonStrings) {
ExpectDiagnosticsFor(
R"code(
#include "unchecked_optional_access_test.h"
@@ -1839,9 +1840,9 @@ TEST_P(UncheckedOptionalAccessTest, ValueOrComparison) {
}
}
)code");
+}
- // Pointer-to-optional.
- //
+TEST_P(UncheckedOptionalAccessTest, ValueOrComparisonPointerToOptional) {
// FIXME: make `opt` a parameter directly, once we ensure that all `optional`
// values have a `has_value` property.
ExpectDiagnosticsFor(