11 Commits

Author SHA1 Message Date
martinboehme
526c9b7e37
[clang][nullability] Use proves() and assume() instead of deprecated synonyms. (#70297) 2023-10-30 13:18:57 +01:00
Martin Braenne
b244b6ae0b [clang][dataflow] Remove Strict suffix from accessors.
For the time being, we're keeping the `Strict` versions around as deprecated synonyms so that clients can be migrated, but these synonyms will be removed soon.

Depends On D156673

Reviewed By: ymandel, xazax.hun

Differential Revision: https://reviews.llvm.org/D156674
2023-07-31 19:40:09 +00:00
Martin Braenne
e95134b9cb [clang][dataflow] Reverse course on getValue() deprecation.
In the [value categories RFC](https://discourse.llvm.org/t/70086), I proposed that the end state of the migration should be that `getValue()` should only be legal to call on prvalues.

As a stepping stone, to allow migrating off existing calls to `getValue()`, I proposed introducing `getValueStrict()`, which would already have the new semantics.

However, I've now reconsidered this. Any expression, whether prvalue or glvalue, has a value, so really there isn't any reason to forbid calling `getValue()` on glvalues. I'm therefore removing the deprecation from `getValue()` and transitioning existing `getValueStrict()` calls back to `getValue()`.

The other "strict" accessors are a different case. `setValueStrict()` should only be called on prvalues because glvalues need to have a storage location associated with them; it doesn't make sense to only set a value for them. And, of course, `getStorageLocationStrict()` and `setStorageLocationStrict()` should obviously only be called on glvalues because prvalues don't have storage locations.

Reviewed By: ymandel, xazax.hun

Differential Revision: https://reviews.llvm.org/D155921
2023-07-27 13:14:49 +00:00
Sam McCall
6272226b9f [dataflow] Remove deprecated BoolValue flow condition accessors
Use the Formula versions instead, now.

Differential Revision: https://reviews.llvm.org/D155152
2023-07-13 09:39:23 +02:00
Martin Braenne
96b22e1c37 [clang][dataflow] Use Strict accessors in SignAnalysisTest.cpp.
This patch is part of the ongoing migration to strict handling of value categories (see https://discourse.llvm.org/t/70086 for details).

Depends On D150656

Reviewed By: sammccall, ymandel, xazax.hun

Differential Revision: https://reviews.llvm.org/D150657
2023-05-22 06:51:13 +00:00
Martin Braenne
0c852dc88e [clang][dataflow][NFC] Remove SkipPast param from getValue(const ValueDecl &).
This parameter was already a no-op, so removing it doesn't change behavior.

Reviewed By: ymandel

Differential Revision: https://reviews.llvm.org/D150137
2023-05-09 07:42:20 +00:00
Martin Braenne
9940fac753 [clang][dataflow][NFC] Remove SkipPast parameter from `getStorageLocation(const ValueDecl &).
This parameter was already a no-op, so removing it doesn't change behavior.

Depends On D149144

Reviewed By: ymandel, xazax.hun, gribozavr2

Differential Revision: https://reviews.llvm.org/D149151
2023-05-08 07:10:44 +00:00
Yitzhak Mandelbaum
6b991ba486 [clang][dataflow] Change transfer API to take a reference.
The provided `CFGElement` is never null, so a reference is a more precise type.

Differential Revision: https://reviews.llvm.org/D143920
2023-02-15 15:37:21 +00:00
Jordan Rupprecht
3432f4bf86 [test] Split out Annotations from TestingSupport
The Annotations helper class does not have a gtest or gmock dependency, but because it's bundled with the rest of TestingSupport, it gets one. By splitting it out, a target can use it without being forced to use LLVM's copy of gtest.

Reviewed By: GMNGeoffrey, sammccall, gribozavr2

Differential Revision: https://reviews.llvm.org/D141175
2023-01-12 13:40:47 -08:00
Fangrui Song
a996cc217c Remove unused #include "llvm/ADT/Optional.h" 2022-12-05 06:31:11 +00:00
Gabor Marton
93ce23adb5 [clang][dataflow] Add initial sign analysis
This patch adds an initial implementation for sign analysis, with the
following lattice (T: top, N: negative, Z: zero, P: positive, B: bottom):
  T
/ | \
N Z P
\ | /
  B
The lattice is implemented with `BoolValue` properties attached to other
`Value`s.

Differential Revision: https://reviews.llvm.org/D136668
2022-10-26 15:13:22 +02:00