summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/test/clang-tidy/misc-suspicious-string-compare.c
Commit message (Collapse)AuthorAgeFilesLines
* [clang-tidy] Another batch of checks to rename from misc- to bugprone-.Alexander Kornienko2018-02-281-79/+0
| | | | | | | | | | | | | | | | Summary: clang-tidy/rename_check.py {misc,bugprone}-suspicious-semicolon clang-tidy/rename_check.py {misc,bugprone}-suspicious-string-compare clang-tidy/rename_check.py {misc,bugprone}-swapped-arguments clang-tidy/rename_check.py {misc,bugprone}-undelegated-constructor --check_class_name UndelegatedConstructor Reviewers: hokein, sammccall, aaron.ballman Subscribers: klimek, mgorny, xazax.hun, cfe-commits Differential Revision: https://reviews.llvm.org/D43870 llvm-svn: 326386
* [clang-tidy] Enhance misc-suspicious-string-compare to move down ↵Etienne Bergeron2016-04-261-0/+13
| | | | | | | | | | | | | | | | | | | | | | false-positives. Summary: The checker was noisy when running over llvm code base. This patch is impriving the way string-compare functions are matched. 1) By default, do not report !strcmp(...) unless it's activate by the user, 2) Only match suspicious expression over a subset of expression (binary operator), 3) Added matching of macro wrapper used with clang on linux. See bug: 27465. Reviewers: alexfh Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D19497 llvm-svn: 267570
* [clang-tidy] Add new checker for comparison with runtime string functions.Etienne Bergeron2016-04-211-0/+66
Summary: This checker is validating suspicious usage of string compare functions. Example: ``` if (strcmp(...)) // Implicitly compare to zero if (!strcmp(...)) // Won't warn if (strcmp(...) != 0) // Won't warn ``` This patch was checked over large amount of code. There is three checks: [*] Implicit comparator to zero (coding-style, many warnings found), [*] Suspicious implicit cast to non-integral (bugs!?, almost none found), [*] Comparison to suspicious constant (bugs!?, found two cases), Example: [[https://github.com/kylepjohnson/sigma/blob/master/sigma/native-installers/debian/dependencies/files/opt/sigma/E/HEURISTICS/che_to_precgen.c | https://github.com/kylepjohnson/sigma/blob/master/sigma/native-installers/debian/dependencies/files/opt/sigma/E/HEURISTICS/che_to_precgen.c]] ``` else if(strcmp(id, "select") == 0) { array->array[i].key1 = 25; } else if(strcmp(id, "sk") == 28) // BUG!? { array->array[i].key1 = 20; } ``` Reviewers: alexfh Subscribers: Eugene.Zelenko, cfe-commits Differential Revision: http://reviews.llvm.org/D18703 llvm-svn: 267009
OpenPOWER on IntegriCloud