[PATCH] D30771: [analyzer] Teach the MallocChecker about Glib API for two arguments

Daniel Marjamäki via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 20 23:06:53 PDT 2017


danielmarjamaki added a comment.

I don't have further comments except that I would personally rewrite:

  // Get the value of the size argument.
  SVal TotalSize = State->getSVal(Arg1, LCtx);
  if (SuffixWithN) {
    const Expr *Arg2 = CE->getArg(2);
    TotalSize = evalMulForBufferSize(C, Arg1, Arg2);
  }

to:

  // Get the value of the size argument.
  SVal TotalSize;
  if (!SuffixWithN) {
    TotalSize = State->getSVal(Arg1, LCtx);
  } else {
    TotalSize = evalMulForBufferSize(C, Arg1, CE->getArg(2));
  }


Repository:
  rL LLVM

https://reviews.llvm.org/D30771





More information about the cfe-commits mailing list