Possible inaccuracy in CallAndMessageChecker

Alexander Smirnov via cfe-commits cfe-commits at lists.llvm.org
Sat Mar 26 12:27:03 PDT 2016


I'm working on a simple checker for objc block calls and faced some strange
behaviour of ConstraintsManager.

Even for simple case like this:

- (void) callObjcBlock:(void(^)(void)) blockVar {
    blockVar();
}

ConstraintsManager believes that called 'blockVar' is constrained to be non
null, not unknown.

I have noticed that with disabled 'CallAndMessageChecker'
ConstraintsManager begins to work correctly.

I believe that managed to localise the problematic code. At the end of
'CallAndMessageChecker::checkPreStmt' method at CallAndMessageChecker.cpp.
StNonNull state is added as transition to CheckerContext without prior
checking that StNull is nullptr.

Isn't it would be more correct to write it this way:

  if(!StNull) {
    C.addTransition(StNonNull);
  }

Could someone suggest me should or should not it be fixed ?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160326/3bb69be4/attachment.html>


More information about the cfe-commits mailing list