[PATCH] D154935: [clang][dataflow] Introduce `getFieldValue()` test helpers.

Gábor Horváth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 11 07:17:42 PDT 2023


xazax.hun accepted this revision.
xazax.hun added inline comments.


================
Comment at: clang/unittests/Analysis/FlowSensitive/DataflowEnvironmentTest.cpp:94
   Environment Env(DAContext, *Fun);
-  Value *Val = Env.createValue(Ty);
-  ASSERT_NE(Val, nullptr);
-  StructValue *SVal = clang::dyn_cast<StructValue>(Val);
-  ASSERT_NE(SVal, nullptr);
-  Val = SVal->getChild(*R);
-  ASSERT_NE(Val, nullptr);
-  PointerValue *PV = clang::dyn_cast<PointerValue>(Val);
-  EXPECT_NE(PV, nullptr);
+  StructValue *SVal = clang::cast<StructValue>(Env.createValue(Ty));
+  PointerValue *PV = cast_or_null<PointerValue>(getFieldValue(SVal, *R, Env));
----------------



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D154935



More information about the cfe-commits mailing list