[cfe-dev] Type conversion problem in Clang Static Analyzer

Pengfei Wang via cfe-dev cfe-dev at lists.llvm.org
Wed Nov 18 03:04:12 PST 2015


Hello everyone,

Recently I am using the Clang Static Analyzer in my research work, and
basically writing my own checker. However I come across a problem on the
type conversion.

I wanted to convert *SVal* type to *SymbolRef* type or *SymExpr* type in
some callback function, and I tried several methods, like:

const SymExpr* symexpr = Sval.getAsSymExpr()

const SymbolRef symbolref = Sval.getAsSymbol()

const SymExpr* symexpr2 = Sval.getAsSymbolicExpression()

const SymbolRef symbolref2 = Sval.getAsLocSymbol()
 but none of them worked, and all I got was a NULL pointer.

Do I made any mistake when using them? or should these functions be used
under some special situation? Actually the value of SVal can be dumped to
print, but I just can not make these conversions.

Need your help and looking forward for your reply, thank you!


Kind regards
Pengfei
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20151118/7f04a4af/attachment.html>


More information about the cfe-dev mailing list