Eugene Zelenko
04d38c5f52
[Clang-tidy] Alphabetical sort of files/checks. Add space after clang-tidy in source code headers.
...
llvm-svn: 342601
2018-09-20 00:02:55 +00:00
Stephen Kelly
c09197e086
Port getLocEnd -> getEndLoc
...
Subscribers: nemanjai, ioeric, kbarton, cfe-commits
Differential Revision: https://reviews.llvm.org/D50355
llvm-svn: 339401
2018-08-09 22:43:02 +00:00
Stephen Kelly
43465bf3fd
Port getLocStart -> getBeginLoc
...
Reviewers: javed.absar
Subscribers: nemanjai, kbarton, ilya-biryukov, ioeric, jkorous, arphaman, jfb, cfe-commits
Differential Revision: https://reviews.llvm.org/D50354
llvm-svn: 339400
2018-08-09 22:42:26 +00:00
Alexander Kornienko
785322c5e8
[clang-tidy] Fix http://llvm.org/PR38055
...
llvm-svn: 336283
2018-07-04 15:19:49 +00:00
Alexander Kornienko
f7ad8bfbad
[clang-tidy] misc-unused-parameters - retain old behavior under StrictMode
...
Summary: This addresses https://bugs.llvm.org/show_bug.cgi?id=37467 .
Reviewers: klimek, ilya-biryukov, lebedev.ri, aaron.ballman
Reviewed By: lebedev.ri, aaron.ballman
Subscribers: aaron.ballman, lebedev.ri, xazax.hun, cfe-commits
Differential Revision: https://reviews.llvm.org/D46951
llvm-svn: 335863
2018-06-28 15:21:25 +00:00
Manuel Klimek
d88caa21e6
Do not warn on unused parameters for functions with empty bodies.
...
If a function has an empty body, all parameters are trivially unused.
llvm-svn: 331875
2018-05-09 13:20:03 +00:00
Gabor Horvath
2735166156
[clang-tidy] Fix PR35468
...
Differential Revision: https://reviews.llvm.org/D46003
llvm-svn: 330719
2018-04-24 14:45:58 +00:00
Alexander Kornienko
67112853c2
[clang-tidy] rename_check.py misc-unused-raii bugprone-unused-raii --check_class_name=UnusedRAIICheck
...
llvm-svn: 327610
2018-03-15 08:27:42 +00:00
Alexander Kornienko
68fb65f413
[clang-tidy] rename_check.py misc-sizeof-container bugprone-sizeof-container
...
llvm-svn: 327608
2018-03-15 08:26:47 +00:00
Alexander Kornienko
3273888536
[clang-tidy] rename_check.py misc-sizeof-expression bugprone-sizeof-expression
...
llvm-svn: 327607
2018-03-15 08:26:19 +00:00
Alexander Kornienko
7ff6076129
[clang-tidy] rename_check.py {misc,bugprone}-macro-parentheses
...
llvm-svn: 327606
2018-03-15 08:25:39 +00:00
Alexander Kornienko
eb9d944419
[clang-tidy] Another batch of checks to rename from misc- to bugprone-.
...
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
2018-02-28 23:47:15 +00:00
Alexander Kornienko
cb6d320345
Rename more checks from misc- to bugprone-.
...
Summary:
clang-tidy/rename_check.py {misc,bugprone}-string-integer-assignment
clang-tidy/rename_check.py {misc,bugprone}-string-literal-with-embedded-nul
clang-tidy/rename_check.py {misc,bugprone}-suspicious-enum-usage
clang-tidy/rename_check.py {misc,bugprone}-suspicious-missing-comma
Reviewers: hokein, sammccall, aaron.ballman
Subscribers: klimek, cfe-commits, mgorny
Differential Revision: https://reviews.llvm.org/D43868
llvm-svn: 326384
2018-02-28 23:30:29 +00:00
Alexander Kornienko
a1a2933634
Rename a few checks from misc- to bugprone-.
...
Summary:
rename_check.py {misc,bugprone}-forwarding-reference-overload
rename_check.py {misc,bugprone}-macro-repeated-side-effects
rename_check.py {misc,bugprone}-lambda-function-name
rename_check.py {misc,bugprone}-misplaced-widening-cast
Reviewers: hokein, sammccall, aaron.ballman
Reviewed By: aaron.ballman
Subscribers: klimek, cfe-commits, mgorny
Differential Revision: https://reviews.llvm.org/D43867
llvm-svn: 326327
2018-02-28 14:47:20 +00:00
Benjamin Kramer
f8c99297d3
[tidy] Move private ast matchers into anonymous namespaces to avoid ODR conflicts.
...
No functionality change intended.
llvm-svn: 325467
2018-02-18 19:02:35 +00:00
Benjamin Kramer
a9bef621b0
[clang-tidy] Widen anonymous namespace.
...
The matchers in this check are prone to create ODR violations otherwise.
No functionality change.
llvm-svn: 324083
2018-02-02 13:39:00 +00:00
Benjamin Kramer
492f1cc8c7
[clang-tidy] Remove global constructor. No functionality change intended.
...
llvm-svn: 324080
2018-02-02 13:23:24 +00:00
Benjamin Kramer
10db8d6dbc
[clang-tidy] Don't reinvent the wheel, use existing log2 functions.
...
This also makes the code ready for int128, even though I think it's
currently impossible to get an int128 into this code path.
llvm-svn: 324079
2018-02-02 13:23:21 +00:00
Alexander Kornienko
396fc87694
[clang-tidy] misc-redundant-expression: fix a crash under ubsan
...
llvm-svn: 323980
2018-02-01 16:39:12 +00:00
Alexander Kornienko
4256fd0b4b
clang-tidy/rename_check.py misc-incorrect-roundings bugprone-incorrect-roundings
...
More specifically,
clang-tidy/rename_check.py misc-incorrect-roundings \
bugprone-incorrect-roundings --check_class_name IncorrectRoundings
llvm-svn: 323768
2018-01-30 15:12:24 +00:00
Alexander Kornienko
5c9c0427bb
clang-tidy/rename_check.py misc-string-compare readability-string-compare
...
llvm-svn: 323766
2018-01-30 14:55:50 +00:00
Gabor Horvath
91c6671a71
[clang-tidy] Misc redundant expression checker updated for ineffective bitwise operator expressions
...
Examples:
* Always evaluates to 0:
```
int X;
if (0 & X) return;
```
* Always evaluates to ~0:
```
int Y;
if (Y | ~0) return;
```
* The symbol is unmodified:
```
int Z;
Z &= ~0;
```
Patch by: Lilla Barancsuk!
Differential Revision: https://reviews.llvm.org/D39285
llvm-svn: 321168
2017-12-20 12:22:16 +00:00
Alexander Kornienko
1bfcba8cea
[clang-tidy] Move more checks from misc- to performance-
...
Summary:
rename_check.py misc-move-const-arg performance-move-const-arg
rename_check.py misc-noexcept-move-constructor performance-noexcept-move-constructor
Reviewers: hokein, xazax.hun
Reviewed By: xazax.hun
Subscribers: rnkovacs, klimek, mgorny, xazax.hun, cfe-commits
Differential Revision: https://reviews.llvm.org/D40507
llvm-svn: 319183
2017-11-28 16:41:03 +00:00
Aaron Ballman
c566139632
Add an option to misc-move-const-arg to not diagnose on trivially copyable types.
...
Patch by Oleg Smolsky
llvm-svn: 319111
2017-11-27 22:59:33 +00:00
Gabor Horvath
250c40dc26
[clang-tidy] Misc redundant expressions check updated for overloaded operators
...
Patch by: Lilla Barancsuk
Differential Revision: https://reviews.llvm.org/D39243
llvm-svn: 319033
2017-11-27 15:05:24 +00:00
Alexander Kornienko
6e39e68983
[clang-tidy] Move checks from misc- to performance-
...
Summary:
rename_check.py misc-move-constructor-init performance-move-constructor-init
rename_check.py misc-inefficient-algorithm performance-inefficient-algorithm
Reviewers: hokein, aaron.ballman
Reviewed By: hokein, aaron.ballman
Subscribers: aaron.ballman, mgorny, xazax.hun, cfe-commits
Differential Revision: https://reviews.llvm.org/D40487
llvm-svn: 319023
2017-11-27 13:06:28 +00:00
Alexander Kornienko
d4ac4afda7
[clang-tidy] Move a few more checks from misc to bugprone.
...
Summary:
clang_tidy/rename_check.py misc-assert-side-effect bugprone-assert-side-effect
clang_tidy/rename_check.py misc-bool-pointer-implicit-conversion bugprone-bool-pointer-implicit-conversion
clang_tidy/rename_check.py misc-fold-init-type bugprone-fold-init-type
clang_tidy/rename_check.py misc-forward-declaration-namespace bugprone-forward-declaration-namespace
clang_tidy/rename_check.py misc-inaccurate-erase bugprone-inaccurate-erase
clang_tidy/rename_check.py misc-move-forwarding-reference bugprone-move-forwarding-reference
clang_tidy/rename_check.py misc-multiple-statement-macro bugprone-multiple-statement-macro
clang_tidy/rename_check.py misc-use-after-move bugprone-use-after-move
clang_tidy/rename_check.py misc-virtual-near-miss bugprone-virtual-near-miss
Manually fixed a reference to UseAfterMoveCheck in the hicpp module.
Manually fixed header guards.
Reviewers: hokein
Reviewed By: hokein
Subscribers: nemanjai, mgorny, javed.absar, xazax.hun, kbarton, cfe-commits
Differential Revision: https://reviews.llvm.org/D40426
llvm-svn: 318950
2017-11-24 14:16:29 +00:00
Alexander Kornienko
4b9ee769ca
[clang-tidy] rename_check.py misc-dangling-handle bugprone-dangling-handle
...
Reviewers: hokein
Reviewed By: hokein
Subscribers: mgorny, xazax.hun, cfe-commits
Differential Revision: https://reviews.llvm.org/D40389
llvm-svn: 318941
2017-11-24 09:52:05 +00:00
Alexander Kornienko
6f67bcbb93
[clang-tidy] rename_check.py misc-argument-comment bugprone-argument-comment
...
Summary: + manually convert the unit test to lit test.
Reviewers: hokein
Reviewed By: hokein
Subscribers: mgorny, xazax.hun, cfe-commits
Differential Revision: https://reviews.llvm.org/D40392
llvm-svn: 318926
2017-11-23 17:02:48 +00:00
Alexander Kornienko
a3251bf24c
[clang-tidy] rename_check.py misc-string-constructor bugprone-string-constructor
...
Summary:
Rename misc-string-constructor to bugprone-string-constructor +
manually update the lenght of '==='s in the doc file.
Reviewers: hokein, xazax.hun
Reviewed By: hokein, xazax.hun
Subscribers: mgorny, xazax.hun, cfe-commits
Differential Revision: https://reviews.llvm.org/D40388
llvm-svn: 318916
2017-11-23 13:49:14 +00:00
Gabor Horvath
ec87e17c84
[clang-tidy] Misc redundant expressions checker updated for macros
...
Redundant Expression Checker is updated to be able to detect expressions that
contain macros. Also, other small details are modified to improve the current
implementation.
The improvements in detail are as follows:
* Binary and ternary operator expressions containing two constants, with at
least one of them from a macro, are detected and tested for redundancy.
Macro expressions are treated somewhat differently from other expressions,
because the particular values of macros can vary across builds.
They can be considered correct and intentional, even if macro values equal,
produce ranges that exclude each other or fully overlap, etc.
* The code structure is slightly modified: typos are corrected,
comments are added and some functions are renamed to improve comprehensibility,
both in the checker and the test file. A few test cases are moved to another
function.
* The checker is now able to detect redundant CXXFunctionalCastExprs as well.
A corresponding test case is added.
Patch by: Lilla Barancsuk!
Differential Revision: https://reviews.llvm.org/D38688
llvm-svn: 317570
2017-11-07 13:17:58 +00:00
Benjamin Kramer
252dd8b745
[clang-tidy] Use a more efficient map for the virtual near miss check.
...
DenseMap performs better here. No functionality change intended.
llvm-svn: 315277
2017-10-10 07:21:51 +00:00
Richard Smith
2ccecb9d88
Fix up clang-tidy after clang r314037.
...
llvm-svn: 314047
2017-09-22 23:47:20 +00:00
Alexander Kornienko
7b9f3e28cc
[clang-tidy] Fixed misc-unused-parameters omitting parameters square brackets
...
Summary:
Bug: https://bugs.llvm.org/show_bug.cgi?id=34449
**Problem:**
Clang-tidy check misc-unused-parameters comments out parameter name omitting following characters (e.g. square brackets) what results in its complete removal. Compilation errors might occur after clang-tidy fix as well.
**Patch description:**
Changed removal range. The range should end after parameter name, not after whole parameter declarator (which might be followed by e.g. square brackets).
Reviewers: alexfh
Reviewed By: alexfh
Subscribers: JDevlieghere, xazax.hun, cfe-commits
Tags: #clang-tools-extra
Patch by Pawel Maciocha!
Differential Revision: https://reviews.llvm.org/D37846
llvm-svn: 313355
2017-09-15 11:28:28 +00:00
Alexander Kornienko
e5590927d6
[clang-tidy] fixed misc-unused-parameters omitting parameters default value
...
Summary:
Bug: https://bugs.llvm.org/show_bug.cgi?id=34450
**Problem:**
Clang-tidy check misc-unused-parameters omits parameter default value what results in its complete removal. Compilation errors might occur after clang-tidy fix.
**Patch description:**
Changed removal range. The range should end after parameter declarator, not after whole parameter declaration (which might contain a default value).
Reviewers: alexfh, xazax.hun
Reviewed By: alexfh
Subscribers: JDevlieghere, cfe-commits
Tags: #clang-tools-extra
Patch by Pawel Maciocha!
Differential Revision: https://reviews.llvm.org/D37566
llvm-svn: 313150
2017-09-13 14:55:13 +00:00
Peter Szecsi
2087113f6c
[clang-tidy] SuspiciousEnumUsageCheck bugfix
...
iThere is a reported bug on the checker not handling the some APSInt values
correctly: https://bugs.llvm.org/show_bug.cgi?id=34400
This patch aims to fix it.
Differential Revision: https://reviews.llvm.org/D37572
llvm-svn: 313016
2017-09-12 09:40:13 +00:00
Daniel Marjamaki
cad8443724
[clang-tidy] Fix 'misc-misplaced-widening-cast' assertion error.
...
Reviewers: alexfh, xazax.hun, danielmarjamaki
Differential Revision: http://reviews.llvm.org/D36670
llvm-svn: 311984
2017-08-29 06:25:24 +00:00
Benjamin Kramer
1436192d68
[clang-tidy] Don't compute the edit distance if it's over the threshold.
...
No functional change intended.
llvm-svn: 310532
2017-08-09 22:09:29 +00:00
Manuel Klimek
7b9c117b82
Adapt clang-tidy checks to changing semantics of hasDeclaration.
...
Differential Revision: https://reviews.llvm.org/D36154
llvm-svn: 309810
2017-08-02 13:13:11 +00:00
Alexander Kornienko
b1c7432117
[clang-tidy] Unify the way IncludeStyle and HeaderFileExtesions options are used
...
llvm-svn: 308605
2017-07-20 12:02:03 +00:00
Faisal Vali
cb8e01acd0
[NFC] Update function call names as changed in MacroInfo that should refer to Parameters (as opposed to Arguments).
...
This syncs them up with clang commit r308190
Thanks!
llvm-svn: 308191
2017-07-17 17:20:57 +00:00
Gabor Horvath
2990ac1ebd
[clang-tidy] Enable inline variable definitions in headers
...
Differential Revision: https://reviews.llvm.org/D34449
llvm-svn: 306538
2017-06-28 12:47:35 +00:00
Alexander Kornienko
564f1c74b6
Revert "[clang-tidy] When" -fno-exceptions is used", this warning is better to be suppressed."
...
This reverts commit r304949.
https://reviews.llvm.org/D34002#775830
llvm-svn: 305057
2017-06-09 07:34:58 +00:00
Yan Wang
98b74fc7d6
[clang-tidy] When" -fno-exceptions is used", this warning is better to be suppressed.
...
Summary: "misc-noexcept-move-constructor" is better not to be issued when "-fno-exceptions" is set.
Reviewers: chh, alexfh, aaron.ballman
Reviewed By: aaron.ballman
Subscribers: aaron.ballman, cfe-commits, xazax.hun
Tags: #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D34002
llvm-svn: 304949
2017-06-07 22:39:20 +00:00
Alexander Kornienko
f1dc12eb69
[clang-tidy] Make misc-inaccurate-erase work with real C++11 containers.
...
The check failed to match iterator->const_iterator conversion that is happening
at least when using the libstdc++'s vector. We might want to make it match even
more flexible patterns, if we see more false negatives.
llvm-svn: 304879
2017-06-07 08:25:51 +00:00
Alexander Kornienko
0bdd8a1964
[clang-tidy] misc-inaccurate-erase: support call by pointer
...
+ replace matchesName calls with more efficient alternatives.
llvm-svn: 304811
2017-06-06 17:49:45 +00:00
Florian Gross
da197aab63
[clang-tidy] Make misc-static-assert accept assert(!"msg")
...
Added negated string literals to the set of IsAlwaysFalse expressions to avoid flagging of assert(!"msg").
Differential Revision: http://reviews.llvm.org/D33827
llvm-svn: 304657
2017-06-03 10:13:55 +00:00
Alexander Kornienko
a49cfef414
[clang-tidy] Add `const` to operator() to fix a warning.
...
llvm-svn: 304583
2017-06-02 18:47:50 +00:00
Alexander Kornienko
d9a4491b0a
[clang-tidy] check for __func__/__FUNCTION__ in lambdas
...
Add a clang-tidy check for using func__/FUNCTION__ inside lambdas. This
evaluates to the string operator(), which is almost never useful and almost
certainly not what the author intended.
Patch by Bryce Liu!
Differential Revision: https://reviews.llvm.org/D33497
llvm-svn: 304570
2017-06-02 17:36:32 +00:00
Alexander Kornienko
0055d97d4b
[clang-tidy] Use getLocalOrGlobal for the StrictMode option
...
llvm-svn: 304154
2017-05-29 13:59:27 +00:00