summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/unittests
Commit message (Collapse)AuthorAgeFilesLines
...
* clang-tidy explicit constructor check: don't warn on copy or move constructors.Alexander Kornienko2014-03-201-0/+4
| | | | | | | | | | | | | | | | | Summary: http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#Explicit_Constructors "The exception is copy constructors, which, in the rare cases when we allow them, should probably not be explicit." Reviewers: klimek Reviewed By: klimek CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D3122 llvm-svn: 204322
* Post-filter clang-tidy diagnostic messages.Alexander Kornienko2014-03-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch implements filtering of clang-tidy diagnostic messages by the check name, so that "clang-tidy -checks=^llvm-" won't output any clang warnings, for example. This is also helpful to run specific static-analyzer checks: static analyzer always needs core checks to be enabled, but the user may be interested only in the checks he asked for. This patch also exposes warning option names for built-in diagnostics. We need to have a namespace for these names to avoid collisions and to allow convenient filtering, so I prefix them with "-W". I'm not sure it's the best thing to do, and maybe "W" or "clang-diagnostic-" or something like this would be better. Reviewers: klimek Reviewed By: klimek CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D3121 llvm-svn: 204321
* clang-tidy explicit constructors check: don't warn on deleted constructors.Alexander Kornienko2014-03-192-2/+5
| | | | | | | | | | | | Reviewers: klimek Reviewed By: klimek CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D3116 llvm-svn: 204226
* Add an argument comment checker to clang-tidy.Peter Collingbourne2014-03-183-2/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | This checks that parameters named in comments that appear before arguments in function and constructor calls match the parameter name used in the callee's declaration. For example: void f(int x, int y); void g() { f(/*y=*/0, /*z=*/0); } contains two violations of the policy, as the names 'x' and 'y' used in the declaration do not match names 'y' and 'z' used at the call site. I think there is significant value in being able to check/enforce this policy as a way of guarding against accidental API misuse and silent breakages caused by API changes. Although this pattern appears somewhat frequently in the LLVM codebase, this policy is not prescribed by the LLVM coding standards at the moment, so it lives under 'misc'. Differential Revision: http://llvm-reviews.chandlerc.com/D2914 llvm-svn: 204113
* [C++11] Replace OwningPtr with std::unique_ptr.Ahmed Charles2014-03-094-5/+5
| | | | | | | | This removes all references to OwningPtr, which should be fairly undisruptive to out-of-tree projects since they are unlikely to use clang-tools-extra as a library instead of a set of tools. llvm-svn: 203382
* [cleanup] Re-sort headers with llvm/utils/sort_includes.py.Chandler Carruth2014-03-041-1/+1
| | | | llvm-svn: 202809
* [C++11] Replace LLVM_OVERRIDE with 'override'Craig Topper2014-03-022-3/+3
| | | | llvm-svn: 202632
* Made the ClangTidyTest helper class independent of the testing framework.Alexander Kornienko2014-02-273-57/+59
| | | | | | | | | | | | Reviewers: klimek Reviewed By: klimek CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D2895 llvm-svn: 202399
* Fix ExplicitConstructorCheck to warn only on in-class declarations.Alexander Kornienko2014-02-131-0/+5
| | | | | | | | | | | | | | | | Summary: I'm not absolutely sure this is 100% correct solution, but it seems to do what I expect. Reviewers: djasper, klimek Reviewed By: djasper CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D2756 llvm-svn: 201308
* Add completion to the query parser, and hook it up to clang-query.Peter Collingbourne2014-02-011-16/+41
| | | | | | Differential Revision: http://llvm-reviews.chandlerc.com/D2263 llvm-svn: 200604
* Re-applied r198807, r198808 with an additional change to fix linking in ↵Alexander Kornienko2014-01-091-0/+1
| | | | | | configure Release+Asserts build. llvm-svn: 198875
* Run llvm/utils/sort_includes.py over the Clang tools code. This doesn'tChandler Carruth2014-01-076-7/+5
| | | | | | | | | | always produce as pretty of results as it does in LLVM and Clang, but I don't mind and the value of having a single canonical ordering is very high IMO. Let me know if you spot really serious problems here. llvm-svn: 198703
* [CMake] clang-tools-extra: Update dependencies.NAKAMURA Takumi2013-12-104-17/+12
| | | | llvm-svn: 196860
* Make clang's static analyzer checks available through clang-tidy.Manuel Klimek2013-11-142-0/+3
| | | | | | | | | | | | | This is implemented in a way that the current static analyzer architecture allows, in the future we might want to revisit this. With this change static analyzer checks are available from clang-tidy by specifying -checks=clang-analyzer-<name>. This change also fixes the use of the compilation database to allow clang-tidy to be used like any other clang tool. llvm-svn: 194707
* Introduce clang-query tool.Peter Collingbourne2013-11-086-1/+241
| | | | | | | | | | | | | | | | | | | | | | | This tool is for interactive exploration of the Clang AST using AST matchers. It currently allows the user to enter a matcher at an interactive prompt and view the resulting bindings as diagnostics, AST pretty prints or AST dumps. Example session: $ cat foo.c void foo(void) {} $ clang-query foo.c -- clang-query> match functionDecl() Match #1: foo.c:1:1: note: "root" binds here void foo(void) {} ^~~~~~~~~~~~~~~~~ 1 match. Differential Revision: http://llvm-reviews.chandlerc.com/D2098 llvm-svn: 194227
* clang-modernize: Apply replacements using clang-apply-replacementsEdwin Vane2013-10-056-264/+10
| | | | | | | | | | | | | | | | | | | | | Summary: The clang-apply-replacements process is now invoked to apply replacements between applying transforms. This resulted in a massive simplification of the tool: - FileOverrides class no longer needed. - Change tracking and code formatting no longer needed. - No more dependency on libclangApplyReplacements. - Final syntax check is easier to do directly now than with a separate header/source pair. Replacement handling stuff abstracted into a new header/source pair to de-clutter ClangModernize.cpp somewhat. Tests updated. Differential Revision: http://llvm-reviews.chandlerc.com/D1836 llvm-svn: 192032
* Fix build by adding dep on TransformUtilsEdwin Vane2013-09-301-1/+2
| | | | | | clang-apply-replacements unittest Makefile wasn't linking in TransformUtils. llvm-svn: 191669
* clang-apply-replacements: Add code formatting functionalityEdwin Vane2013-09-3013-6/+126
| | | | | | | | | | | | | | The tool now supports a collection of arguments to turn on and provide settings for the formatting of code affected by applying replacements: * --format turns on formatting (default style is LLVM) * --style controls code style settings * --style-config allows one to explicitly indicate where a style config file lives. The libclangApplyReplacements interface has a new function to turn Replacements into Ranges to be used with tooling::reformat(). llvm-svn: 191667
* clang-modernize: Fixing a few left over cpp11-migrate referencesEdwin Vane2013-09-262-5/+5
| | | | | | Build files for unit tests hadn't been updated yet. llvm-svn: 191451
* Transform files in a compilation database if no sources are provided.Ariel J. Bernal2013-09-121-1/+1
| | | | | | | Compile all files in a compilation database or a subset determined by a sub-directory so you don't have to specify them manually. llvm-svn: 190630
* clang-modernize: Remove -headers optionEdwin Vane2013-09-061-26/+8
| | | | | | | | | | | | clang-modernize can now transform headers properly and the experimental -headers option is no longer necessary. Remember, at least -include is necessary for indicating which headers are allowed to be changed. Differential Revision: http://llvm-reviews.chandlerc.com/D1610 llvm-svn: 190158
* Update the header guards for clang-modernize's unittests.Chandler Carruth2013-09-042-6/+6
| | | | llvm-svn: 189974
* Fix up a few straggling bits of the build system. This should fix theChandler Carruth2013-09-042-2/+2
| | | | | | | build of the clang-modernize unittest which is for some reason not being built by default on my system (sorry about that). llvm-svn: 189966
* Rename cpp11-migrate to clang-modernize.Chandler Carruth2013-09-0413-13/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | There is no reason to expect this tool to be limited to C++11, it seems very likely to be of on-going interest. It seems likely to be useful for modernizing even as new libraries come out in TSes and other formats than a complete standard. Fundamentally, we need something a bit more general. After some discussion on the list, going with 'clang-modernize'. I've tried to do a reasonably comprehensive job of fixing up the names, but I may still have missed some. Feel free to poke me if you spot any fallout here. Things I've tried reasonably hard to find and fix: - cpp11-migrate -> clang-modernize - Migrator -> Modernizer - Clean up the introductory documentation that was C++11 specific. I'll also point out that this tool continues to delight me. =] Also, a huge thanks to those who have so carefully, thoroughly documented the tool. The docs here are simply phenomenal. Every tool should be this well documented. I hope I have updated the documentation reasonably well, but I'm not very good at documentation, so review much appreciated. llvm-svn: 189960
* Rename clang-replace -> clang-apply-replacementsEdwin Vane2013-09-032-3/+3
| | | | | | | | Made changes throughout clang-tools-extra for the renaming of clang-replace to clang-apply-replacements as per feedback from community. llvm-svn: 189832
* cpp11-migrate: Refactor for driver model of operationEdwin Vane2013-09-037-101/+154
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Re-commit of r189691 and r189689 now with a proper autoconf fix. Massive simplification of how replacements and file overrides are handled by the migrator: * Sources and headers are all treated the same. * All replacements for a given translation unit are stored in the same TranslationUnitReplacements structure. * Change tracking is updated only from main file; no need for propagating "is tracking" flag around. * Transform base class no longer responsible for applying replacements. They are simply stored and main() looks after deduplication and application. * Renamed -yaml-only to -serialize-replacements. Same restrictions apply: Can only request one transform. New restriction: formatting cannot also be turned on since it's basically a transform. * If -serialize-replacements is requested, changes to files will not be applied on disk. * Changed behaviour of function generating names for serialized replacements: Only the main source file goes into the name of the file since a file may contain changes for multiple different files. * Updated HeaderReplacements LIT test for new serialization behaviour. * Replaced old test that ensures replacements are not serialized if -serialize-replacements is not provided. New version ensures changes are made directly to all files in the translation unit. * Updated unit tests. * Due to major simplification of structures in FileOverrides.h, the FileOverridesTest is quite a bit simpler now. llvm-svn: 189798
* Revert "cpp11-migrate: Fixing autoconf build after adding libclangReplace ↵Michael Gottesman2013-08-307-154/+101
| | | | | | | | | | | | | | | | | dependency" Revert "cpp11-migrate: Refactor for driver model of operation" This reverts commit r189691. This reverts commit r189689. This was breaking the phase 1 OS X build for ~2 hours. https://smooshbase.apple.com/buildbot-internal/builders/phase1%20-%20sanity/builds/9559 I reverted the latter commit since I think the latter depended on the former. llvm-svn: 189700
* cpp11-migrate: Fixing autoconf build after adding libclangReplace dependencyEdwin Vane2013-08-301-2/+2
| | | | llvm-svn: 189691
* cpp11-migrate: Refactor for driver model of operationEdwin Vane2013-08-306-99/+152
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Massive simplification of how replacements and file overrides are handled by the migrator: * Sources and headers are all treated the same. * All replacements for a given translation unit are stored in the same TranslationUnitReplacements structure. * Change tracking is updated only from main file; no need for propagating "is tracking" flag around. * Transform base class no longer responsible for applying replacements. They are simply stored and main() looks after deduplication and application. * Renamed -yaml-only to -serialize-replacements. Same restrictions apply: Can only request one transform. New restriction: formatting cannot also be turned on since it's basically a transform. * If -serialize-replacements is requested, changes to files will not be applied on disk. * Changed behaviour of function generating names for serialized replacements: Only the main source file goes into the name of the file since a file may contain changes for multiple different files. * Updated HeaderReplacements LIT test for new serialization behaviour. * Replaced old test that ensures replacements are not serialized if -serialize-replacements is not provided. New version ensures changes are made directly to all files in the translation unit. * Updated unit tests. * Due to major simplification of structures in FileOverrides.h, the FileOverridesTest is quite a bit simpler now. Differential Revision: http://llvm-reviews.chandlerc.com/D1545 llvm-svn: 189689
* cpp11-migrate: Add a class to support include directives modificationsGuillaume Papin2013-08-273-7/+424
| | | | | | | | | | | The IncludeDirectives class helps with detecting and modifying #include directives. For now it allows the users to add angled-includes in a source file. This is a start for this class that will evolve in the future to add more functionality. This should fix the reverted commit r189037 (buildbot failures on Windows). llvm-svn: 189354
* Revert "cpp11-migrate: Add a class to support include directives modifications"Guillaume Papin2013-08-223-427/+7
| | | | | | | | | | This reverts commit r189017. It broke the windows bots: - http://bb.pgr.jp/builders/ninja-clang-i686-msc17-R/builds/4176 - http://bb.pgr.jp/builders/cmake-clang-i686-mingw32/builds/3837 llvm-svn: 189037
* cpp11-migrate: Add a class to support include directives modificationsGuillaume Papin2013-08-223-7/+427
| | | | | | | | | | | The IncludeDirectives class helps with detecting and modifying #include directives. For now it allows the users to add angled-includes in a source file. This is a start for this class that will evolve in the future to add more functionality. This should fix the reverted commit r188791 (buildbot failures on Windows). llvm-svn: 189017
* cpp11-migrate: Use Replacement serialization from clang::toolingEdwin Vane2013-08-202-74/+0
| | | | | | | | Serialization of replacements has been moved to clang::tooling. Differential Revision: http://llvm-reviews.chandlerc.com/D1423 llvm-svn: 188820
* UniqueHeaderNameTest.cpp: Appease valgrind.NAKAMURA Takumi2013-08-201-2/+2
| | | | | | llvm::sys::path::native(dst, dst) might be overridden-safe in most cases, though. llvm-svn: 188800
* Revert "cpp11-migrate: Add a class to support include directives modifications"Guillaume Papin2013-08-203-391/+7
| | | | | | | | This reverts commit r188791. The Windows bots are still broken. llvm-svn: 188795
* cpp11-migrate: Add a class to support include directives modificationsGuillaume Papin2013-08-203-7/+391
| | | | | | | | | | | The IncludeDirectives class helps with detecting and modifying #include directives. For now it allows the users to add angled-includes in a source file. This is a start for this class that will evolve in the future to add more functionality. This should fix the reverted commit r188610 (buildbot failures on Windows). llvm-svn: 188791
* Add dependencies on TransformUtils library in preparation for re-applying ↵Alexey Samsonov2013-08-192-2/+4
| | | | | | r188666 llvm-svn: 188674
* Revert "cpp11-migrate: Add a class to support include directives modifications"Guillaume Papin2013-08-173-372/+5
| | | | | | | | | This reverts commit r188610. Issue with the absolute include paths not found in the unit tests on the Windows bots. Needs investigation. llvm-svn: 188611
* cpp11-migrate: Add a class to support include directives modificationsGuillaume Papin2013-08-173-5/+372
| | | | | | | | | The IncludeDirectives class helps with detecting and modifying #include directives. For now it allows the users to add angled-includes in a source file. This is a start for this class that will evolve in the future to add more functionality. llvm-svn: 188610
* cpp11-migrate: Remove mention of 'headers' from serialization codeEdwin Vane2013-08-143-27/+22
| | | | | | | | | | | | | * HeaderChangeDocument -> MigratorDocument * HeaderFileName -> TargetFile * SourceFileName -> MainSourceFile * Removed TransformID * Comments updated, at least with respect to serialization * Unit tests updated. Differential Revision: http://llvm-reviews.chandlerc.com/D1403 llvm-svn: 188404
* cpp11-migrate: Write header replacements to diskTareq A. Siraj2013-08-136-15/+109
| | | | | | | | | | | | | | | | | | | | | | | | Another attempt to commit r187204 after windows related problems has been fixed. Note that changes to this patch reflect the current behavior of cpp11-migrate. Header replacements are now written to disk in YAML format for an external tool to merge. A unique file will be created in the same directory as the header with all replacements that came from a source file that included the header file. The YAML file will have: - Name of the header file - Name of the source file that included the header file - Transform ID that generated the replacement - Offset - Length - Replacement text Any tool reading these replacements should read them using the HeaderChangeDocument struct. Differential Revision: http://llvm-reviews.chandlerc.com/D1369 llvm-svn: 188274
* cpp11-migrate: Fixed path problem with include/exclude pathsTareq A. Siraj2013-08-091-1/+19
| | | | | | | | | | This fixes a problem when the path separator in the include/exclude directory is different (e.g. "\" vs. "/") from the path separator in the file path we are modifying. Differential Revision: http://llvm-reviews.chandlerc.com/D1326 llvm-svn: 188094
* Fix clang-tidy dependencies and bad file comment.Daniel Jasper2013-08-041-0/+2
| | | | | | This addresses comments in post-commit review of r187345. llvm-svn: 187707
* Fixed path differences when using include/exclude headersAriel J. Bernal2013-07-311-0/+17
| | | | | | Added function for removing relative operators from input paths. llvm-svn: 187481
* Revert "cpp11-migrate: Write header replacements to disk"Rafael Espindola2013-07-306-117/+15
| | | | | | | This reverts commit 187428. It broke the windows bots. http://bb.pgr.jp/builders/ninja-clang-i686-msc17-R/builds/3450 llvm-svn: 187447
* cpp11-migrate: Write header replacements to diskTareq A. Siraj2013-07-306-15/+117
| | | | | | | | | | | | | | | | | | | | Committing r187204 with fixes for darwin. Note that one of the lit tests are disabled on windows due to a bug in writing header replacements to file. Header replacements are now written to disk in YAML format for an external tool to merge. A unique file will be created in the same directory as the header with all replacements that came from a source file that included the header file. The YAML file will have: - Name of the file - Transform ID that generated the replacement - Offset - Length - Replacement text Any tool reading these replacements should read them using the TransformDocument struct. llvm-svn: 187428
* cpp11-migrate: Add -for-compilers command line switch.Guillaume Papin2013-07-291-0/+22
| | | | | | | | | This change add a new option command line option -for-compilers that allows the user to enable multiple transforms automatically. Another difference is that now all transforms are enabled by default. llvm-svn: 187360
* Initial architecture for clang-tidy.Daniel Jasper2013-07-297-1/+162
| | | | | | | | | | | This is the first version of a possible clang-tidy architecture. The purpose of clang-tidy is to detect errors in adhering to common coding patterns, e.g. described in the LLVM Coding Standards. This is still heavily in flux. Review: http://llvm-reviews.chandlerc.com/D884 llvm-svn: 187345
* Revert "cpp11-migrate: Write header replacements to disk"Rafael Espindola2013-07-266-117/+15
| | | | | | | | This reverts commit 187204. It broke the freebsd bots: http://lab.llvm.org:8011/builders/clang-X86_64-freebsd/builds/9561 llvm-svn: 187227
* cpp11-migrate: Write header replacements to diskTareq A. Siraj2013-07-266-15/+117
| | | | | | | | | | | | | | | | | | | Header replacements are now written to disk in YAML format for an external tool to merge. A unique file will be created in the same directory as the header with all replacements that came from a source file that included the header file. The YAML file will have: - Name of the file - Transform ID that generated the replacement - Offset - Length - Replacement text Any tool reading these replacements should read them using the TransformDocument struct. Differential Revision: http://llvm-reviews.chandlerc.com/D1142 llvm-svn: 187204
OpenPOWER on IntegriCloud