[cfe-users] Expr objects and Evaluate*

folkert via cfe-users cfe-users at lists.llvm.org
Mon Aug 1 00:20:12 PDT 2016


Hi,

I have an Expr object. How can I know if I can invoke
EvaluateAsBooleanCondition, EvaluateAsRValue, EvaluateAsInt and
EvaluateAsFloat ?
Because if I just call them on any Expr object, I get assertions like:

llvm/tools/clang/include/clang/AST/Type.h:612: const clang::ExtQualsTypeCommonBase* clang::QualType::getCommonPtr() const: Assertion `!isNull() && "Cannot retrieve a NULL type pointer"' failed

#3  0x00007f65aa2111b2 in __GI___assert_fail (assertion=0x11e6450 "!isNull() && \"Cannot retrieve a NULL type pointer\"", file=0x11e61d0 "/home/folkert/llvm/tools/clang/include/clang/AST/Type.h", line=612,
    function=0x1780040 <_ZZNK5clang8QualType12getCommonPtrEvE19__PRETTY_FUNCTION__> "const clang::ExtQualsTypeCommonBase* clang::QualType::getCommonPtr() const") at assert.c:101
#4  0x0000000000ea5713 in clang::QualType::getCommonPtr() const [clone .part.1700] ()
#5  0x0000000000ec3727 in clang::Expr::EvaluateAsInt(llvm::APSInt&, clang::ASTContext const&, clang::Expr::SideEffectsKind) const ()


Folkert van Heusden

-- 
----------------------------------------------------------------------
Phone: +31-6-41278122, PGP-key: 1F28D8AE, www.vanheusden.com


More information about the cfe-users mailing list