From: Kristof Umann Date: Fri, 5 Jul 2019 11:14:57 +0000 (+0000) Subject: Fix a buildbot failure due to the AST's lifetime ending before the test X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=884e734a1eb0303efb5b3ef90239191e66671e50;p=clang Fix a buildbot failure due to the AST's lifetime ending before the test git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@365181 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/unittests/Analysis/CFGTest.cpp b/unittests/Analysis/CFGTest.cpp index bf0116050a..2ab3b6403a 100644 --- a/unittests/Analysis/CFGTest.cpp +++ b/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' - // `-DeclRefExpr 0xd07bd8 '_Bool' lvalue ParmVar 0xd07960 'C' '_Bool' - - assert(isa(E)); - assert(++E->child_begin() == E->child_end()); - const auto *D = dyn_cast(*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. //===--------------------------------------------------------------------===//