[PATCH] D20689: [clang-tidy] Suspicious Call Argument checker

Barancsuk Lilla via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 15 06:33:03 PDT 2017


barancsuk added a comment.

@alexfh, would you mind taking a look at the changes that have been introduced in the new patch?

The main improvements are:

- The checker has been shifted to the module `readability`.
- It is checked, whether implicit type conversion is possible from the argument to the parameter.

I have run the modified checker on some large code bases with the following results:
 (The errors were categorized subjectively.)

- **PostgreSQL:** 32 renaming opportunities of 39 warnings
- **Cpython:** 10 renaming opportunities of 15 warnings
- **Xerces:** 6 renaming opportunities of 8 warnings
- **FFmpeg**:  5 renaming opportunities of 9 warnings
- **OpenSSL:** 3 renaming opportunities of 4 warnings
- **LLVM:** 20 renaming opportunities of 44 warnings

This article provides some evidence to support the feasibility of the checker as well. 
F5358417: icse2016-names.pdf <https://reviews.llvm.org/F5358417> 
The authors have proven that argument names are generally very similar to the corresponding parameters' names. 
The presented empirical evidence also shows, that argument and parameter name dissimilarities are strong indicators of incorrect argument usages, or they identify renaming opportunities to improve code readability. 
Moreover the authors have even found 3 existing bugs in open source projects.


https://reviews.llvm.org/D20689





More information about the cfe-commits mailing list