[PATCH] D34275: [analyzer] Re-implemente current virtual calls checker in a path-sensitive way

wangxin via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 12 07:29:43 PDT 2017


wangxindsb updated this revision to Diff 106204.
wangxindsb added a comment.

- Change IsVirtualCall(const CallExpr *CE) to be a free static function.
- Rename some variables.
- Improve the BugReporterVisitor, enclose the declaration names in single quotes.
- Hoist getSValBuilder() from the if statements.
- Fix some code duplications.
- Use the CXXMemberCall instead CXXInstanceCall in the CheckPreCall.
- Remove IsVirtualCall(CE) from if statements.
- Fix the error of the visitnode() method which may throw a wrong call graph for the code blow.

  class Y {
  public:
    virtual void foobar();
    Y() {
      F f1;
      foobar();
    }
  };

Previous visitnode() will issue the virtual function called from the F(); Current visitnode() fix this bug.


https://reviews.llvm.org/D34275

Files:
  lib/StaticAnalyzer/Checkers/VirtualCallChecker.cpp
  test/Analysis/virtualcall.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34275.106204.patch
Type: text/x-patch
Size: 23452 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170712/12992d93/attachment-0001.bin>


More information about the cfe-commits mailing list