[PATCH] D48027: [analyzer] Improve `CallDescription` to handle c++ method.

Henry Wong via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 26 09:36:17 PDT 2018


MTC updated this revision to Diff 157499.
MTC added a comment.

@xazax.hun Thanks for your tips! After some investigation, `MatchFinder::match` just traverse one ASTNode, that means `match(namedDecl(HasNameMatcher()))` and `match(namedDecl(matchesName()))` both not traverse children. So there are three ways to match the specified AST node.

1. `match(namedDecl(HasNameMatcher()))` matches the full qualified name that contains template parameter and that's not what we want to see.
2. `match(namedDecl(matchesName()))` uses llvm regex to  match the full qualified name.
3. Unwrap the declaration and match each layer, similar to `HasNameMatcher::matchesNodeFullFast()`.

In this update, I use the third way to match the specified AST node. This is simpler than I thought.

In addition, add a redundant constructor that is only used to construct a `CallDescription` with one name, this avoids the modification of the existing checker, like `BlockInCriticalSectionChecker.cpp`. Any suggestions?


Repository:
  rC Clang

https://reviews.llvm.org/D48027

Files:
  include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h
  lib/StaticAnalyzer/Checkers/InnerPointerChecker.cpp
  lib/StaticAnalyzer/Core/CallEvent.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48027.157499.patch
Type: text/x-patch
Size: 5567 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180726/1959a76d/attachment.bin>


More information about the cfe-commits mailing list