I`m currently making a set of custom OCLint rules for my university and I need to catch statements like:
char *str = strdup("Hello, world!");
if (str == NULL) { // That`s what i`m interested in
...
}
So how do I check if an Expr
is NULL
? I know there is a method Expr::isNullPointerConstant(ASTContext &Ctx, NullPointerConstantValueDependence NPC)
, but I don’t know how to get ASTContext
from my oclint::AbstractASTVisitorRule
. There are no mentions of anything like that in documentation (or that`s just me, idk _(0_0)_/)
How do I do that?