[cfe-dev] [Analyzer] API Usage: The difference between 'CallDescription', 'isCLibraryFunction()' and 'ASTContext.Idents.get()' ?

Henry Wong via cfe-dev cfe-dev at lists.llvm.org
Tue Jan 2 23:33:26 PST 2018


Hi all,

In the implementation of checker, there are three ways to determine whether
CallExpr is the function call specified.
1). 'CallDescription', used in SimpleStreamChecker, BlockInCriticalSectionChecker
  and ValistChecker.
2). 'ASTContext.Idents.get()', used in MallocChecker, StreamChecker and
   PointerArithChecker.
3). 'isCLibraryFunction() and isCPPStdLibraryFunction()', used in CStringChecker.

For 1), my understanding is that CallDescription corresponds to CallEvent.

My question is, for 2) and 3),
- which way is better when determining whether
  a function call is the specified library function?

- Should 'isCPPStdLibraryFunction()' be moved from CStringChecker.cpp to
  CheckerContext.cpp like 'isCLibraryFunction()'?

- If I understand correctly,'ASTContext.Idents.get()' may have false positives,
  for example, ASTContext.Idents.get("malloc") may match to user-defined
  function of the same name. Is that right?

Henry Wong
Qihoo 360 Codesafe Team
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20180103/253a1dab/attachment.html>


More information about the cfe-dev mailing list