[clang] [clang][dataflow] Handle CXXInheritedCtorInitExpr in ResultObjectVisitor. (PR #99616)

via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 22 01:16:26 PDT 2024


================
@@ -442,6 +442,46 @@ TEST_F(EnvironmentTest, CXXDefaultInitExprResultObjIsWrappedExprResultObj) {
             &Env.getResultObjectLocation(*DefaultInit->getExpr()));
 }
 
+TEST_F(EnvironmentTest, ResultObjectLocationForInheritedCtorInitExpr) {
----------------
martinboehme wrote:

We tend to put tests for `getResultObjectLocation()` in TransferTest. See an example for `AtomicExpr` [here](https://github.com/llvm/llvm-project/blob/56ad7cc0126f9899fd884391cfa10b6359206c01/clang/unittests/Analysis/FlowSensitive/TransferTest.cpp#L3391), which you can also use as a model for a test for `CXXInheritedCtorInitExpr`.

Doing this in TransferTest.cpp has the benefit that the test is smaller, plus you can make the assertion stronger (see the test for `AtomicExpr` linked above which checks the exact value returned by `getResultObjectLocation()` instead of just testing that it is non-null).

https://github.com/llvm/llvm-project/pull/99616


More information about the cfe-commits mailing list