[PATCH] D12761: MPI-Checker patch for Clang Static Analyzer

Alexander Kornienko via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 8 05:00:18 PST 2015


alexfh added a comment.

In http://reviews.llvm.org/D12761#304651, @Alexander_Droste wrote:

> @Anna 
>  Thanks for having a look once more! I will submit these parts as separate patches.
>
> @Alexander
>  This should be only about the AST-based checks, as Anna takes care of the path-sensitive ones.
>  I think this is not about moving the checks to clang-tidy because they are not linters but detect
>  errors.


Well, many clang-tidy checks have a close to 100% true positive rate and also detect errors of different kinds (as opposed to purely stylistic issues). See http://clang.llvm.org/extra/clang-tidy/checks/misc-undelegated-constructor.html for an example. There's nothing that prevents adding more error-detecting checks to clang-tidy.

I also think, that true power of the static analyzer is the path-based analysis capability, but clang-tidy provides a more convenient way to implement AST- or preprocessor-based checks, so most of the AST-based checks should live there (unless they are generic and high-quality enough to be a compiler diagnostic).

> The AST-based functionality is roughly structured as followed:


I'm not an expert in the static analyzer code, so I'm not the one to review even AST-based checks there. However, if you decide to move them to clang-tidy, I'll be happy to review that (I suggest introducing a top-level module for MPI-related checks and putting all relevant AST-based checks there).

> `MPIChecker.cpp` : This is the entry point class where `checkASTDecl` is the only callback for AST-based

>  checks. There the `TranslationUnitVisitor` is used which traverses the complete TU passed.

>  During the traversal each check is executed in the course of the `VisitCallExpr` callback. 

>  The AST-based checks are implemented in `MPICheckerAST.(cpp|h)`. The `TypeVisitor `, contained

>  in `TypeVisitor.h`, is used as a helper class, in order to detect type properties.

> 

> This patch contains 3 AST-based checks (type mismatch, incorrect buffer referencing, invalid argument type)

>  which are described here in detail (see 3.1 AST-Based Checks) :

>  https://dl.acm.org/ft_gateway.cfm?id=2833159&ftid=1644251&dwn=1&CFID=566596797&CFTOKEN=98261226



http://reviews.llvm.org/D12761





More information about the cfe-commits mailing list