summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/test
Commit message (Collapse)AuthorAgeFilesLines
* Add NamespaceCommentCheck to the Google module.Alexander Kornienko2014-09-221-0/+15
| | | | | | | | | | | | | | | | | Summary: This uses a bit hacky way to set the defaults for the spaces before comments, but it's also one of the simplest ways. Fixed a bug with how the SpacesBeforeComments option was used. Reviewers: djasper Reviewed By: djasper Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D5410 llvm-svn: 218240
* Disable most of the google-readability-casting check for non-C++ files (onlyAlexander Kornienko2014-09-212-1/+14
| | | | | | leave the "redundant cast to the same type" part). llvm-svn: 218225
* [clang-tidy] Add a checker that warns on TODO comments without username.Benjamin Kramer2014-09-182-1/+26
| | | | | | | | | It also suggests a fix-it, taking the name from $USER. This will be made configurable eventually. Differential Revision: http://reviews.llvm.org/D5393 llvm-svn: 218049
* [clang-tidy] Add a checker for long functions.Benjamin Kramer2014-09-151-0/+58
| | | | | | | | | | | | | | | | As this is very dependent on the code base it has some ways of configuration. It's possible to pick between 3 modes of operation: - Line counting: number of lines including whitespace and comments - Statement counting: number of statements within compoundStmts. - Branch counter In addition a threshold can be picked, warnings are only emitted when it is met. The thresholds can be configured via a .clang-tidy file. Differential Revision: http://reviews.llvm.org/D4986 llvm-svn: 217768
* clang-apply-replacements: Deduplicate paths with FileManager.Benjamin Kramer2014-09-091-0/+4
| | | | | | | | Bucket replacements by FileEntry instead of path. The same file with different paths is very common, relative #include paths and symlinks can easily create them. When that occurs we would apply the fix twice. llvm-svn: 217440
* Implemented clang-tidy configurability via .clang-tidy files.Alexander Kornienko2014-09-045-1/+19
| | | | | | | | | | | | | | | | | Summary: This adds a support for the .clang-tidy file reading using FileOptionsProvider, -dump-config option, and changes tests to not depend on default checks set. Reviewers: klimek, bkramer, djasper Reviewed By: djasper Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D5186 llvm-svn: 217155
* [clang-tidy] Add an option to export suggested fixes into a file.Benjamin Kramer2014-09-041-1/+4
| | | | | | | | Allows gathering fixes and applying them with clang-apply-fixes. Differential Revision: http://reviews.llvm.org/D5176 llvm-svn: 217139
* ClangTidy misc-argument-comment check: don't check arguments to templateAlexander Kornienko2014-09-031-3/+14
| | | | | | | | | | | | | | | | | | | parameter packs. Summary: This disables this check for std::bind and similar functions that use parameter packs to forward arguments to a different function. Name of the parameter pack argument doesn't matter. Reviewers: klimek Reviewed By: klimek Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D5168 llvm-svn: 217039
* Remove unused AST matcher.Benjamin Kramer2014-09-021-0/+5
| | | | llvm-svn: 216901
* [clang-tidy] Don't suggest naming the dummy argument of a post-inc operator ↵Benjamin Kramer2014-09-011-3/+19
| | | | | | overload. llvm-svn: 216868
* Try to fix test on msvc and 32 bit hosts.Benjamin Kramer2014-08-291-4/+4
| | | | llvm-svn: 216727
* [clang-tidy] Add a checker that suggests replacing short/long/long long with ↵Benjamin Kramer2014-08-291-0/+54
| | | | | | | | fixed-size types. Differential Revision: http://reviews.llvm.org/D5119 llvm-svn: 216726
* [clang-tidy] Don't suggest naming unnamed parameters on deleted/defaulted ↵Benjamin Kramer2014-08-291-0/+3
| | | | | | functions. llvm-svn: 216718
* Revert rL215947: "[clang-rename] revert r215839"Manuel Klimek2014-08-202-0/+27
| | | | | | Make tests not depend on grep supporting -bo. llvm-svn: 216041
* [clang-rename] revert r215839Gerolf Hoflehner2014-08-182-25/+0
| | | | | | | | | | | | | | | | | | | | The commit broke public build bots for more than 24 hours. (view as text) ******************** TEST 'Clang Tools :: clang-rename/VarTest.cpp' FAILED ******************** Script: -- cat /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin11-nobootstrap-RAincremental/clang.src/tools/extra/test/clang-rename/VarTest.cpp > /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin11-nobootstrap-RAincremental/clang-build/tools/clang/tools/extra/test/clang-rename/Output/VarTest.cpp.tmp.cpp clang-rename -offset=$(grep -FUbo 'foo;' /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin11-nobootstrap-RAincremental/clang-build/tools/clang/tools/extra/test/clang-rename/Output/VarTest.cpp.tmp.cpp | head -1 | cut -d: -f1) -new-name=hector /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin11-nobootstrap-RAincremental/clang-build/tools/clang/tools/extra/test/clang-rename/Output/VarTest.cpp.tmp.cpp -i -- sed 's,//.*,,' /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin11-nobootstrap-RAincremental/clang-build/tools/clang/tools/extra/test/clang-rename/Output/VarTest.cpp.tmp.cpp | FileCheck /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin11-nobootstrap-RAincremental/clang.src/tools/extra/test/clang-rename/VarTest.cpp -- Exit Code: 1 Command Output (stderr): -- clang-rename: could not find symbol at /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin11-nobootstrap-RAincremental/clang-build/tools/clang/tools/extra/test/clang-rename/Output/VarTest.cpp.tmp.cpp:2:1 (offset 14). llvm-svn: 215947
* First version of a clang-rename tool.Manuel Klimek2014-08-172-0/+25
| | | | | | | | | | | | | | | | Summary: Note that this code is still grossly under-tested - the next steps will be to add significantly better test coverage. Patch by Matthew Plant. Test Plan: Reviewers: Subscribers: llvm-svn: 215839
* AvoidCStyleCastsCheck: don't warn on casts in macrosAlexander Kornienko2014-08-161-3/+0
| | | | llvm-svn: 215799
* Try to unbreak the Makefile build.Benjamin Kramer2014-08-131-0/+1
| | | | llvm-svn: 215545
* Also run extra tools unit tests in shared library builds.Benjamin Kramer2014-08-132-5/+24
| | | | | | Took me way too long to figure out why they didn't run. llvm-svn: 215543
* [clang-tidy] Disable the warning on implicit bool* to bool conversion in macros.Benjamin Kramer2014-08-121-4/+3
| | | | | | It's just too noisy and the warning isn't very helpful in those cases. llvm-svn: 215439
* Reverting to Rui's last version, as it actually works both in Darwin and in ↵Alexander Kornienko2014-08-081-1/+1
| | | | | | Linux llvm-svn: 215192
* Closing the loop. Now this sed invocation is back to what it was before the ↵Alexander Kornienko2014-08-081-1/+1
| | | | | | attempts to 'improve' it. llvm-svn: 215189
* Suppress clang-tools-extra/test/clang-tidy/llvm-include-order.cpp for ↵NAKAMURA Takumi2014-08-081-0/+3
| | | | | | | | | | | | | | | | | targeting msvc. Investigating. FYI, I can see the order; #include "j.h" #include "i.h" #include "clang-c/c.h" // hi #include "clang/b.h" #include "llvm-c/d.h" // -c #include "llvm/a.h" #include "gtest/foo.h" #include <s.h> llvm-svn: 215179
* [clang-tidy] Fix sed flag, third tryRui Ueyama2014-08-081-1/+1
| | | | llvm-svn: 215175
* [clang-tidy] Fix sed flag againRui Ueyama2014-08-071-1/+1
| | | | | | | | | Darwin's sed does not recognize -r to tell the tool that the expression is the extended regexp. Seems we don't really need the flag, as the expression is valid as the standard regexp. Removing the flag. llvm-svn: 215171
* [clang-tidy] Fix sed flag.Rui Ueyama2014-08-071-1/+1
| | | | | | | GNU sed does not recognize -E. Use -r that is supported by both BSD and GNU instead. llvm-svn: 215163
* [clang-tidy] Implement the include order checker for LLVM.Benjamin Kramer2014-08-0712-1/+39
| | | | | | | | | | There are still a couple of rough edges in here but it is working fine on LLVM and generates the same results as sort_includes.py if there are no blank lines involved. Differential Revision: http://reviews.llvm.org/D4741 llvm-svn: 215152
* check_clang_tidy_fix.sh: added comments, use set -o errexit instead of '|| ↵Alexander Kornienko2014-08-061-5/+14
| | | | | | exit $?' on each command llvm-svn: 214956
* [clang-tidy] forward arguments of the testing script to clang-tidy.Benjamin Kramer2014-08-061-1/+2
| | | | llvm-svn: 214952
* [clang-tidy] Fix unnamed parameter comment insertion with multiple parameters.Benjamin Kramer2014-08-041-1/+8
| | | | llvm-svn: 214703
* [clang-tidy] Make the named parameter check only warn on declarations if a ↵Benjamin Kramer2014-08-041-21/+28
| | | | | | | | | | | | | | | | definition is visible. Summary: This allows us to copy the parameter name from the definition (as a comment) or insert /*unused*/ in both places. Reviewers: alexfh, klimek Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D4772 llvm-svn: 214701
* [clang-tidy] Add a checker for code that looks like a delegate constructors ↵Benjamin Kramer2014-07-311-0/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | but doesn't delegate. Summary: class Foo { Foo() { Foo(42); // oops } Foo(int); }; This is valid code but it does nothing and we can't emit a warning in clang because there might be side effects. The checker emits a warning for this pattern and also for base class initializers written in this style. There is some overlap with the unused-rtti checker but they follow different goals and fire in different places most of the time. Reviewers: alexfh, djasper Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D4667 llvm-svn: 214397
* Don't warn on NewCallback argument comments, as they are arguments for theAlexander Kornienko2014-07-301-8/+16
| | | | | | | | | | | | | | function the callback points to. Reviewers: djasper Reviewed By: djasper Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D4722 llvm-svn: 214307
* clang-tidy: [use-override] Tweak messages.Daniel Jasper2014-07-282-17/+17
| | | | | | | | It doesn't make sense to suggest 'virtual' as clang-tidy would complain about that on the next iteration (we are never issuing warnings for the base function). llvm-svn: 214063
* check_clang_tidy_fix.sh: Fail immediately if clang-tidy crashes.Benjamin Kramer2014-07-231-1/+1
| | | | | | Otherwise we'll get confusing messages from FileCheck instead of seeing the real issue. llvm-svn: 213739
* Reapply r213647 with a fix.Benjamin Kramer2014-07-231-0/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | ASTMatchers currently have problems mixing bound TypeLoc nodes with Decl/Stmt nodes. That should be fixed soon but for this checker there we only need the TypeLoc to generate a fixit so postpone the potentially heavyweight AST walking until after we know that we're going to emit a warning. This is covered by existing test cases. Original message: [clang-tidy] Add a check for RAII temporaries. This tries to find code similar that immediately destroys an object that looks like it's trying to follow RAII. { scoped_lock(&global_mutex); critical_section(); } This checker will have false positives if someone uses this pattern to legitimately invoke a destructor immediately (or the statement is at the end of a scope anyway). To reduce the number we ignore this pattern in macros (this is heavily used by gtest) and ignore objects with no user-defined destructor. llvm-svn: 213738
* Revert r213647; the added test triggers an assertion.Richard Smith2014-07-231-61/+0
| | | | llvm-svn: 213722
* [clang-tidy] Add a check for RAII temporaries.Benjamin Kramer2014-07-221-0/+61
| | | | | | | | | | | | | | | | | | | | | | | | Summary: This tries to find code similar that immediately destroys an object that looks like it's trying to follow RAII. { scoped_lock(&global_mutex); critical_section(); } This checker will have false positives if someone uses this pattern to legitimately invoke a destructor immediately (or the statement is at the end of a scope anyway). To reduce the number we ignore this pattern in macros (this is heavily used by gtest) and ignore objects with no user-defined destructor. Reviewers: alexfh, djasper Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D4615 llvm-svn: 213647
* [clang-tidy] Fix a false positive in the make_pair checker if an argument ↵Benjamin Kramer2014-07-211-0/+4
| | | | | | | | | has a explicit template argument. This required a rather ugly workaround for a problem in ASTMatchers where callee() is only overloaded for Stmt and Decl but not for Expr. llvm-svn: 213509
* Make the diagnostic message more complete to check the check name.Alexander Kornienko2014-07-171-1/+1
| | | | llvm-svn: 213245
* [clang-tidy] MemsetZeroLenghtChecker: Don't crash trying to evaluate ↵Benjamin Kramer2014-07-171-2/+6
| | | | | | dependent values. llvm-svn: 213238
* [clang-tidy] As a simple heuristic don't emit a swap fixit that would createBenjamin Kramer2014-07-161-0/+4
| | | | | | | | | negative-sized memsets. memset(x, -1, 0) is still useless but swapping makes no sense here. Just emit a warning. llvm-svn: 213157
* [clang-tidy] Also emit a warning for memset(x, 0, 0)Benjamin Kramer2014-07-161-0/+2
| | | | | | | It doesn't make sense to suggest swapping the arguments here but it's still useless code llvm-svn: 213156
* [clang-tidy] Add a checker for zero-length memset.Benjamin Kramer2014-07-161-0/+51
| | | | | | | | | | | | If there's memset(x, y, 0) in the code it's most likely a mistake. The checker suggests a fix-it to swap 'y' and '0'. I think this has the potential to be promoted into a general clang warning after some testing in clang-tidy. Differential Revision: http://reviews.llvm.org/D4535 llvm-svn: 213155
* [clang-tidy] Add namespaces checkers.Benjamin Kramer2014-07-162-0/+15
| | | | | | | | | | This change contains of two checkers that warn about 1. anonymous namespaces in header files. 2. 'using namespace' directives everywhere. Differential Revision: http://reviews.llvm.org/D4523 llvm-svn: 213153
* Avoid adding redundant parens.Alexander Kornienko2014-07-161-1/+15
| | | | | | | | | | | | Reviewers: bkramer Reviewed By: bkramer Subscribers: cfe-commits, sbenza Differential Revision: http://reviews.llvm.org/D4534 llvm-svn: 213149
* [clang-tidy] Add a checker that warns on const string & members.Benjamin Kramer2014-07-161-0/+49
| | | | | | | | | | | | | | Summary: Those are considered unsafe and should be replaced with simple pointers or full copies. It recognizes both std::string and ::string. Reviewers: alexfh, djasper Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D4522 llvm-svn: 213133
* Fix the diagnostic.cpp test to explicitly disable more google checksReid Kleckner2014-07-151-1/+1
| | | | | | | | | Imagine, hypothetically, that you had a build of clang-tidy that enabled the google-* checks by default. If you had such a binary, then this test would fail. Making it pass in that configuration isn't such a bad thing. llvm-svn: 213085
* [clang-tidy] Add a checker that flags unnamed parameters.Benjamin Kramer2014-07-151-0/+72
| | | | | | | | | | | | | | | | Summary: We still allow the escape hatch foo(int /*x*/) and also suggest this in a fixit. This is more powerful than the corresponding cpplint.py check it also flags functions with multiple arguments as naming all arguments is recommended by the google style guide. Reviewers: alexfh, djasper Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D4518 llvm-svn: 213075
* [clang-tidy] extend make_pair test for fixits in template definitions.Benjamin Kramer2014-07-151-0/+4
| | | | llvm-svn: 213068
OpenPOWER on IntegriCloud