summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy/misc
Commit message (Collapse)AuthorAgeFilesLines
...
* [clang-tidy] refactor ExprSequence out of use-after-move checkMarek Sokolowski2016-12-241-261/+3
| | | | | | Differential Revision: https://reviews.llvm.org/D27700 llvm-svn: 290489
* [clang-tidy] Remove duplicated check from move-constructor-initMalcolm Parsons2016-12-172-86/+1
| | | | | | | | | | | | | | | | | | | | Summary: An addition to the move-constructor-init check was duplicating the modernize-pass-by-value check. Remove the additional check and UseCERTSemantics option. Run the move-constructor-init test with both checks enabled. Fix modernize-pass-by-value false-positive when initializing a base class. Add option to modernize-pass-by-value to only warn about parameters that are already values. Reviewers: alexfh, flx, aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D26453 llvm-svn: 290051
* modernize-use-auto NFC fixesPiotr Padlewski2016-12-144-8/+5
| | | | llvm-svn: 289656
* Replace APFloatBase static fltSemantics data members with getter functionsStephan Bergmann2016-12-141-2/+2
| | | | | | | | | | | | | At least the plugin used by the LibreOffice build (<https://wiki.documentfoundation.org/Development/Clang_plugins>) indirectly uses those members (through inline functions in LLVM/Clang include files in turn using them), but they are not exported by utils/extract_symbols.py on Windows, and accessing data across DLL/EXE boundaries on Windows is generally problematic. Differential Revision: https://reviews.llvm.org/D26671 llvm-svn: 289647
* Remove deprecated methods ast_matchers::BoundNodes::{getStmtAs,getDeclAs}Alexander Kornienko2016-12-135-8/+8
| | | | llvm-svn: 289542
* [clang-tools-extra] Format sources with clang-format. NFC.Mandeep Singh Grang2016-11-0837-104/+96
| | | | | | | | | | | | | | | | Summary: Ran clang-format on all .c/.cpp/.h files in clang-tools-extra. Excluded the test, unittests, clang-reorder-fields, include-fixer, modularize and pptrace directories. Reviewers: klimek, alexfh Subscribers: nemanjai Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D26329 llvm-svn: 286221
* [clang-tidy] Simplify matchersAlexander Kornienko2016-11-081-36/+11
| | | | llvm-svn: 286213
* [clang-tidy] Extend misc-use-after-move to support unique_ptr and shared_ptr.Martin Bohme2016-11-021-17/+55
| | | | | | | | | | | | | | Summary: As a unique_ptr or shared_ptr that has been moved from is guaranteed to be null, we only warn if the pointer is dereferenced. Reviewers: hokein, alexfh, aaron.ballman Subscribers: Prazek, cfe-commits Differential Revision: https://reviews.llvm.org/D26041 llvm-svn: 285842
* [Clang-tidy] Fix copy-paste error in misc-redundant-expression detected by ↵Eugene Zelenko2016-11-011-2/+15
| | | | | | | | | | PVS-Studio Also fix some Include What You Use and modernize-use-bool-literals warnings. Differential revision: https://reviews.llvm.org/D26176 llvm-svn: 285721
* Remove 'misc-pointer-and-integral-operation' clang-tidy check. The only casesRichard Smith2016-10-214-143/+0
| | | | | | | it detects are ill-formed (some per C++ core issue 1512, others always have been). llvm-svn: 284888
* [clang-tidy] Add additional diagnostic to misc-use-after-moveMartin Bohme2016-10-141-10/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This adds a diagnostic to the misc-use-after-move check that is output when the use happens on a later loop iteration than the move, for example: A a; for (int i = 0; i < 10; ++i) { a.foo(); std::move(a); } This situation can be confusing to users because, in terms of source code location, the use is above the move. This can make it look as if the warning is a false positive, particularly if the loop is long but the use and move are close together. In cases like these, misc-use-after-move will now output an additional diagnostic: a.cpp:393:7: note: the use happens in a later loop iteration than the move Reviewers: hokein Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D25612 llvm-svn: 284235
* [clang-tidy] Fix template agrument false positives in unused-using-decls.Haojian Wu2016-10-111-0/+14
| | | | | | | | | | | | | | Summary: * Fix a false postive when an using class is used in an explicit template instantiation. * Fix a false postive when an using template class is used as template argument. Reviewers: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D25437 llvm-svn: 283879
* [clang-tidy] Cleaning up language options.Gabor Horvath2016-09-249-15/+12
| | | | | | Differential Revision: https://reviews.llvm.org/D24881 llvm-svn: 282319
* [clang-tidy] Add dependency on clangAnalysis to clangTidyMiscModuleMartin Bohme2016-09-141-0/+1
| | | | | | | | | | | | | Summary: This is needed for the recently submitted misc-use-after-move check (rL281453). For some reason, this still built under Linux, but it caused the PPC build bot to fail. Subscribers: beanz, cfe-commits, mgorny Differential Revision: https://reviews.llvm.org/D24561 llvm-svn: 281460
* [clang-tidy] Add check 'misc-use-after-move'Martin Bohme2016-09-144-0/+682
| | | | | | | | | | | | | | | | Summary: The check warns if an object is used after it has been moved, without an intervening reinitialization. See user-facing documentation for details. Reviewers: sbenza, Prazek, alexfh Subscribers: beanz, mgorny, shadeware, omtcyfz, Eugene.Zelenko, Prazek, fowles, ioeric, cfe-commits Differential Revision: https://reviews.llvm.org/D23353 llvm-svn: 281453
* [clang-tidy] Add check 'misc-move-forwarding-reference'Martin Bohme2016-08-304-0/+187
| | | | | | | | | | | | | | | | | | | | | | | Summary: The check emits a warning if std::move() is applied to a forwarding reference, i.e. an rvalue reference of a function template argument type. If a developer is unaware of the special rules for template argument deduction on forwarding references, it will seem reasonable to apply std::move() to the forwarding reference, in the same way that this would be done for a "normal" rvalue reference. This has a consequence that is usually unwanted and possibly surprising: If the function that takes the forwarding reference as its parameter is called with an lvalue, that lvalue will be moved from (and hence placed into an indeterminate state) even though no std::move() was applied to the lvalue at the callsite. As a fix, the check will suggest replacing the std::move() with a std::forward(). This patch requires D23004 to be submitted before it. Reviewers: sbenza, aaron.ballman Subscribers: klimek, etienneb, alexfh, aaron.ballman, Prazek, Eugene.Zelenko, mgehre, cfe-commits Projects: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D22220 llvm-svn: 280077
* [clang-tidy misc-move-const-arg] more specific messages + suggest ↵Alexander Kornienko2016-08-241-4/+9
| | | | | | alternative solution llvm-svn: 279666
* [clang-tidy] misc-argument-comment non-strict modeAlexander Kornienko2016-08-042-22/+39
| | | | | | | | | | | | | | | | | Summary: The misc-argument-comment check now ignores leading and trailing underscores and case. The new `StrictMode` local/global option can be used to switch back to strict checking. Add getLocalOrGlobal version for integral types, minor cleanups. Reviewers: hokein, aaron.ballman Subscribers: aaron.ballman, Prazek, cfe-commits Differential Revision: https://reviews.llvm.org/D23135 llvm-svn: 277729
* [clang-tidy] Fix an unused-using-decl false positive about template arguments inHaojian Wu2016-08-021-3/+17
| | | | | | | | | | | | | | | | function call expression. Summary: The check doesn't mark the template argument as used when the template argument is a template. Reviewers: djasper, alexfh Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D22803 llvm-svn: 277444
* [clang-tidy] remove trailing whitespaces and retabKirill Bobyrev2016-08-0114-14/+14
| | | | llvm-svn: 277340
* Revert test commitMartin Bohme2016-07-261-1/+0
| | | | | | This reverts rL276746. llvm-svn: 276752
* Test commit -- adding a newlineMartin Bohme2016-07-261-0/+1
| | | | llvm-svn: 276746
* [clang-tidy] Fix misc-definitions-in-headers misplaced fixing to fully ↵Haojian Wu2016-07-131-2/+2
| | | | | | | | | | | | templated function. Reviewers: alexfh, aaron.ballman Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D22260 llvm-svn: 275263
* [clang-tidy] Enhance redundant-expression checkEtienne Bergeron2016-07-072-0/+516
| | | | | | | | | | | | Summary: This patch is adding support to recognize more complex redundant expressions. Reviewers: alexfh Subscribers: aaron.ballman, cfe-commits, chrisha Differential Revision: http://reviews.llvm.org/D21392 llvm-svn: 274731
* [clang-tidy] Fix more enum declaration cases in misc-unused-using-decls check.Haojian Wu2016-07-041-0/+3
| | | | | | | | | | | | Summary: Fix PR28350. Reviewers: alexfh Subscribers: aaron.ballman, Eugene.Zelenko, cfe-commits Differential Revision: http://reviews.llvm.org/D21833 llvm-svn: 274496
* [clang-tidy] Warning enum unused using declarations.Haojian Wu2016-06-271-3/+6
| | | | | | | | | | Reviewers: alexfh, aaron.ballman Subscribers: aaron.ballman, cfe-commits Differential Revision: http://reviews.llvm.org/D21747 llvm-svn: 273882
* [clang-tidy] Don't run misc-definitions-in-headers check in failing TUs.Haojian Wu2016-06-271-0/+4
| | | | | | | | | | Reviewers: alexfh Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D21470 llvm-svn: 273849
* Fix clang-tidy patterns to adapt to newly added ExprWithCleanups nodes.Tim Shen2016-06-211-1/+3
| | | | | | | | | | | | Summary: This is a fix for the new ExprWithCleanups introduced by clang's temporary variable lifetime marks change. Reviewers: bkramer, sbenza, angelgarcia, alexth Subscribers: rsmith, cfe-commits Differential Revision: http://reviews.llvm.org/D21243 llvm-svn: 273310
* [clang-tidy] misc-move-const-arg: Fix typosAlexander Kornienko2016-06-162-5/+5
| | | | | | | | | | | | Reviewers: alexfh Subscribers: cfe-commits Patch by Martin Boehme! Differential Revision: http://reviews.llvm.org/D21366 llvm-svn: 272897
* [clang-tidy] misc-move-const-arg: Detect if result of std::move() is being ↵Alexander Kornienko2016-06-161-21/+47
| | | | | | | | | | | | | | | | | | | | | | | | passed as a const ref argument Summary: Conceptually, this is very close to the existing functionality of misc-move-const-arg, which is why I'm adding it here and not creating a new check. For example, for a type A that is both movable and copyable, this const A a1; A a2(std::move(a1)); is not only a case where a const argument is being passed to std::move(), but the result of std::move() is also being passed as a const reference (due to overload resolution). The new check typically triggers (exclusively) in cases where people think they're dealing with a movable type, but in fact the type is not movable. Reviewers: hokein, aaron.ballman, alexfh Subscribers: aaron.ballman, cfe-commits Patch by Martin Boehme! Differential Revision: http://reviews.llvm.org/D21223 llvm-svn: 272896
* Apply performance-unnecessary-value-param to clang-tidy.Benjamin Kramer2016-06-151-5/+5
| | | | | | With minor manual tweaks. No functionality change intended. llvm-svn: 272795
* [clang-tidy] misc-argument-comment: don't bail out when an argument is a ↵Alexander Kornienko2016-06-082-13/+8
| | | | | | | | macro expansion (e.g. NULL). Add CHECK-FIX tests. llvm-svn: 272155
* [clang-tidy] misc-macro-parentheses - avoid adding parentheses in variable ↵Daniel Marjamaki2016-06-081-2/+49
| | | | | | | | | | | | | | declarations Fixes bugzilla issues 26273 and 27399 Reviewers: alexfh Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D20853 llvm-svn: 272128
* Add the misc-misplaced-const check to clang-tidy, which diagnoses when a ↵Aaron Ballman2016-06-074-0/+103
| | | | | | const-qualifier is applied to a typedef of pointer type rather than to the pointee type. llvm-svn: 272025
* [clang-tidy] Ignore the deleted function in misc-definitions-in-headers.Haojian Wu2016-06-071-6/+8
| | | | | | | | | | Reviewers: alexfh Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D21059 llvm-svn: 271991
* [clang-tidy] Ignore function context in misc-unused-using-decls.Haojian Wu2016-06-032-5/+20
| | | | | | | | | | | | Summary: Make the check's behavior more correct when handling using-decls in multiple scopes. Reviewers: alexfh Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D20909 llvm-svn: 271632
* [ASTMatchers] Added ignoringParenImpCasts to has matchersPiotr Padlewski2016-05-3114-60/+78
| | | | | | | | | has matcher changed behaviour, and now it matches "as is" and doesn't skip implicit and paren casts http://reviews.llvm.org/D20801 llvm-svn: 271289
* Fix a wrong check in misc-unused-using-declsHaojian Wu2016-05-301-13/+11
| | | | | | | | | | | | | | Summary: We should check whether a UsingDecl is defined in macros or in class definition, not TargetDecls of the UsingDecl. Reviewers: alexfh Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D20666 llvm-svn: 271199
* Commiting for http://reviews.llvm.org/D20365Mads Ravn2016-05-231-0/+4
| | | | llvm-svn: 270470
* [clang-tidy] Switch to a more common way of customizing check behavior.Alexander Kornienko2016-05-201-2/+4
| | | | | | | This should have been done this way from the start, however I somehow missed r257177. llvm-svn: 270215
* [clang-tidy] Handle using-decls with more than one shadow decl.Haojian Wu2016-05-202-35/+53
| | | | | | | | | | Reviewers: alexfh Subscribers: cfe-commits, djasper Differential Revision: http://reviews.llvm.org/D20429 llvm-svn: 270191
* [clang-tidy] Use unresolvedLookupExpr node matcher from ASTMatcher.Haojian Wu2016-05-181-7/+0
| | | | | | | | | | Reviewers: alexfh, aaron.ballman Subscribers: aaron.ballman, cfe-commits Differential Revision: http://reviews.llvm.org/D20367 llvm-svn: 269928
* [clang-tidy] Fix a template function false positive in ↵Haojian Wu2016-05-181-0/+16
| | | | | | | | | | | | | | misc-unused-using-decls check. Summary: Ignore warning uninstantiated template function usages. Reviewers: djasper, alexfh Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D20326 llvm-svn: 269906
* [clang-tidy] Lift common matchers to utils namespaceEtienne Bergeron2016-05-171-9/+1
| | | | | | | | | | | | | | Summary: This patch is lifting matchers used by more than one checkers to the common namespace. Reviewers: aaron.ballman, alexfh Subscribers: aaron.ballman, cfe-commits Differential Revision: http://reviews.llvm.org/D19841 llvm-svn: 269804
* [clang-tidy] Skip misc-macro-parentheses for namespaces (Fix PR27400)Vedant Kumar2016-05-171-0/+4
| | | | | | | | | If a use of a macro argument is preceded by the `namespace` keyword, do not warn that the use should be wrapped in parentheses. Patch by Mads Ravn! llvm-svn: 269786
* [clang-tidy] Ignore using-declarations defined in marcro in ↵Haojian Wu2016-05-121-0/+4
| | | | | | | | | | | | misc-unused-using-decls checks. Reviewers: djasper Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D20197 llvm-svn: 269278
* [clang-tidy] Improve misc-redundant-expression and decrease false-positiveEtienne Bergeron2016-05-121-13/+96
| | | | | | | | | | | | | | | | | | Summary: This patch is adding support for conditional expression and overloaded operators. To decrease false-positive, this patch is adding a list of banned macro names that has multiple variant with same integer value. Also fixed support for template instantiation and added an unittest. Reviewers: alexfh Subscribers: klimek, Sarcasm, cfe-commits Differential Revision: http://reviews.llvm.org/D19703 llvm-svn: 269275
* [clang-tidy] Add missing dependency of libtooling to misc moduleEtienne Bergeron2016-05-111-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The new API for fixit is in libtooling and the library misc in clang-tidy didn't had the appropriate dependency. This commit was breaking some build bots: http://reviews.llvm.org/D19547 This commit tried (but failed) to fix it: http://reviews.llvm.org/D20180 To repro, you can make a build with these flags: ``` cmake -DBUILD_SHARED_LIBS=ON ``` Thanks rnk@ for helping figuring out. Reviewers: alexfh, rnk Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D20182 llvm-svn: 269240
* [clang-tidy] Refactoring of FixHintUtilsEtienne Bergeron2016-05-111-35/+10
| | | | | | | | | | | | | | Summary: Refactor some checkers to use the tooling re-writing API. see: http://reviews.llvm.org/D19941 Reviewers: klimek, alexfh Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D19807 llvm-svn: 269210
* [clang-tidy] Add FixIt for swapping arguments in string-constructor-checker.Etienne Bergeron2016-05-111-4/+12
| | | | | | | | | | | | | | | | | | Summary: Arguments can be swapped using fixit when they are not in macros. This is the same implementation than SwappedArguments. Some code got lifted to be reused. Others checks are not safe to be fixed as they tend to be bugs or errors. It is better to let the user manually review them. Reviewers: alexfh Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D19547 llvm-svn: 269208
OpenPOWER on IntegriCloud