[PATCH] D103094: [analyzer] Implemented RangeSet::Factory::castTo function to perform promotions, truncations and conversions.

Denys Petrov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 23 09:59:08 PDT 2021


ASDenysPetrov added a comment.

I'll update tommorow.



================
Comment at: clang/unittests/StaticAnalyzer/RangeSetTest.cpp:120
+
+  template <typename T> const llvm::APSInt &from(T X) {
+    static llvm::APSInt Int = APSIntTy<T>.getZeroValue();
----------------
vsavchenko wrote:
> Default to `BaseType`?
It's implicitly deduced. I think it is not necessary.


================
Comment at: clang/unittests/StaticAnalyzer/RangeSetTest.cpp:131
+  template <typename T>
+  RangeSet from(RawRangeSetT<T> Init, APSIntType Ty = APSIntTy<BaseType>) {
     RangeSet RangeSet = F.getEmptySet();
----------------
vsavchenko wrote:
> Unused parameter?
Oh... :-)


================
Comment at: clang/unittests/StaticAnalyzer/RangeSetTest.cpp:721-799
+TYPED_TEST(RangeSetCastToNoopTest, RangeSetCastToNoopTest) {
+  // Just to reduce the verbosity.
+  using F = typename TypeParam::FromType; // From
+  using T = typename TypeParam::ToType;   // To
+
+  using TV = TestValues<T>;
+  constexpr auto MIN = TV::MIN;
----------------
vsavchenko wrote:
> If loop and promotion share the same test case, why should we split them into two groups?
Yes, the tests are identical but they use different `testing::Types` in the suites. Also I don't want to mix them to make problem localizing easier if occurs. But still  I haven't strong preferences on that.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D103094/new/

https://reviews.llvm.org/D103094



More information about the cfe-commits mailing list