diff options
author | Kristof Umann <dkszelethus@gmail.com> | 2019-07-05 11:14:57 +0000 |
---|---|---|
committer | Kristof Umann <dkszelethus@gmail.com> | 2019-07-05 11:14:57 +0000 |
commit | 433edaed127c16fd641d9515d1340a01086058ff (patch) | |
tree | ad99a6573b4a12b208deae0f253c18d6c2dcf486 | |
parent | 8b25d9bf0119d1c4f8467d2158220790b0595a29 (diff) | |
download | llvm-433edaed127c16fd641d9515d1340a01086058ff.zip llvm-433edaed127c16fd641d9515d1340a01086058ff.tar.gz llvm-433edaed127c16fd641d9515d1340a01086058ff.tar.bz2 |
Fix a buildbot failure due to the AST's lifetime ending before the test
llvm-svn: 365181
-rw-r--r-- | clang/unittests/Analysis/CFGTest.cpp | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/clang/unittests/Analysis/CFGTest.cpp b/clang/unittests/Analysis/CFGTest.cpp index bf01160..2ab3b64 100644 --- a/clang/unittests/Analysis/CFGTest.cpp +++ b/clang/unittests/Analysis/CFGTest.cpp @@ -86,24 +86,10 @@ TEST(CFG, ConditionExpr) { return *(cfg->begin() + Index); }; - auto GetExprText = [] (const Expr *E) -> std::string { - // It's very awkward trying to recover the actual expression text without - // a real source file, so use this as a workaround. We know that the - // condition expression looks like this: - // - // ImplicitCastExpr 0xd07bf8 '_Bool' <LValueToRValue> - // `-DeclRefExpr 0xd07bd8 '_Bool' lvalue ParmVar 0xd07960 'C' '_Bool' - - assert(isa<ImplicitCastExpr>(E)); - assert(++E->child_begin() == E->child_end()); - const auto *D = dyn_cast<DeclRefExpr>(*E->child_begin()); - return D->getFoundDecl()->getNameAsString(); - }; - EXPECT_EQ(GetBlock(1)->getLastCondition(), nullptr); - EXPECT_EQ(GetExprText(GetBlock(4)->getLastCondition()), "A"); - EXPECT_EQ(GetExprText(GetBlock(3)->getLastCondition()), "B"); - EXPECT_EQ(GetExprText(GetBlock(2)->getLastCondition()), "C"); + // Unfortunately, we can't check whether the correct Expr was returned by + // getLastCondition, because the lifetime of the AST ends by the time we + // retrieve the CFG. //===--------------------------------------------------------------------===// |