TEST_P(ASTImporterTestBase, ExprValueKindShouldBeImported) {
Decl *TU = getTuDecl(
R"(
const int &init();
void foo() { const int &a{init()}; }
)", Lang_CXX11, "input0.cc");
auto *FromD = FirstDeclMatcher<VarDecl>().match(TU, varDecl(hasName("a")));
ASSERT_TRUE(FromD->getAnyInitializer());
auto *InitExpr = FromD->getAnyInitializer();
ASSERT_TRUE(InitExpr);
ASSERT_TRUE(InitExpr->isGLValue());
auto *ToD = Import(FromD, Lang_CXX11);
ASSERT_TRUE(ToD);
auto *ToInitExpr = cast<VarDecl>(ToD)->getAnyInitializer();
ASSERT_TRUE(ToInitExpr);
EXPECT_TRUE(ToInitExpr->isGLValue());
}
This results a CSA 'llvm_unreachable' assertion to fire (in radiosw): 'Assume' not implemented for this NonLoc
Since the value kind is not imported, the analyzer engine believes that the given InitListExpr is an rvalue, thus it creates a nonloc::CompoundVal instead of creating memory region (as in case of an lvalue reference).
The following test fails:
This results a CSA 'llvm_unreachable' assertion to fire (in radiosw):
'Assume' not implemented for this NonLoc
Since the value kind is not imported, the analyzer engine believes that the givenInitListExpr
is an rvalue, thus it creates anonloc::CompoundVal
instead of creating memory region (as in case of an lvalue reference).