Commit Graph

848 Commits

Author SHA1 Message Date
John Thompson a5666cadbb Deleted module-map-checker, as it's been folded into modularize.
llvm-svn: 230014
2015-02-20 14:28:10 +00:00
Nick Lewycky d07cfbdaa7 Remove carriage returns.
llvm-svn: 229975
2015-02-20 07:05:56 +00:00
John Thompson 8eb8d93672 Added module map coverage support, extracted from module-map-checker.
llvm-svn: 229869
2015-02-19 16:47:27 +00:00
John Thompson 3c9fb52218 Pruned some unneeded code and comments.
llvm-svn: 229855
2015-02-19 14:31:48 +00:00
John Thompson 41ede8e507 Fixed missing checkins.
llvm-svn: 229699
2015-02-18 17:08:00 +00:00
John Thompson 9cb7964641 Added support for extracting headers from module maps as a source for the header list.
llvm-svn: 229692
2015-02-18 16:14:32 +00:00
John Thompson b87fd7db7c Temporary hack to avoid false errors. Real fix comming.
llvm-svn: 229690
2015-02-18 16:12:26 +00:00
John Thompson eaa4c73d62 Updated file comment on modularize usage, as it was out-of-date.
llvm-svn: 229677
2015-02-18 15:11:12 +00:00
Gabor Horvath 21b76badeb [clang-tidy] Fixed two wrong fix-it cases in misc-inefficient-algorithm checker.
llvm-svn: 229552
2015-02-17 21:45:38 +00:00
John Thompson 3dcb3934c6 Add canonical path conversion function and use it so paths are consistent.
llvm-svn: 229540
2015-02-17 20:43:47 +00:00
John Thompson 9ea81b0041 Fix broken logic for include in block check.
llvm-svn: 229187
2015-02-13 23:32:08 +00:00
John Thompson d845baecb4 Moved header list loading to new class. This is staging for adding module map loading and checking support.
llvm-svn: 229108
2015-02-13 14:29:22 +00:00
Chandler Carruth f766278204 Re-sort includes using the LLVM utils/sort_includes.py script.
llvm-svn: 229087
2015-02-13 09:07:58 +00:00
NAKAMURA Takumi 24fbdf124b Modularize.cpp: Simplify. Vector may be aware of ranged-for.
llvm-svn: 228993
2015-02-13 00:28:32 +00:00
NAKAMURA Takumi c8930de79e Modularize.cpp: Prune CRLFs.
llvm-svn: 228992
2015-02-13 00:28:26 +00:00
NAKAMURA Takumi 43361ae42d clang-tools-extra/test/modularize/NoProblemsList.modularize: Unbreak test.
Don't expect the list were on the current directory.

llvm-svn: 228991
2015-02-13 00:28:21 +00:00
Gabor Horvath 0329519904 [clang-tidy] Fixed a false positive case in misc-inefficient-algorithm checker.
llvm-svn: 228945
2015-02-12 18:19:34 +00:00
John Thompson 97eac4089a Fix broken test in separate build tree.
llvm-svn: 228941
2015-02-12 17:52:28 +00:00
John Thompson 469bbc002a Added support for multiple header list files, as a precursor for when we need to load multiple module maps.
llvm-svn: 228935
2015-02-12 16:22:09 +00:00
John Thompson f1828ef3c6 Fixed incorrect header inclusion tracking resulting in false error reports.
llvm-svn: 228929
2015-02-12 15:26:17 +00:00
Samuel Benzaquen 59c8aa92b8 Add clang-tidy check google-global-names-in-headers.
Summary:
google-global-names-in-headers flags global namespace pollution in header files.
Right now it only triggers on using declarations and directives.

Reviewers: alexfh

Subscribers: curdeius

Differential Revision: http://reviews.llvm.org/D7563

llvm-svn: 228875
2015-02-11 21:21:05 +00:00
John Thompson ecd3b04cd7 Added -block-check-header-list-only option. This is a work-around for private includes that purposefully get included inside blocks.
llvm-svn: 228846
2015-02-11 16:58:36 +00:00
John Thompson 9724431c77 Centralize canonical path conversion.
llvm-svn: 228845
2015-02-11 16:45:50 +00:00
John Thompson 655387887d Fixed module-map-checker to recurse umbrella dirs when collecting headers.
llvm-svn: 228695
2015-02-10 14:58:07 +00:00
John Thompson 5d9862f071 Renamed module.map to module.modulemap (modularize).
llvm-svn: 228693
2015-02-10 14:45:30 +00:00
John Thompson e0aa5fea15 Renamed module.map to module.modulemap.
llvm-svn: 228692
2015-02-10 14:29:16 +00:00
John Thompson ae7f5518c3 The -I option needs a space, apparently, from the actual implementation.
llvm-svn: 228689
2015-02-10 13:51:17 +00:00
Gabor Horvath d4637fb433 [clang-tidy] Checker for inaccurate use of erase() method.
Algorithms like remove() does not actually remove any element from the
container but returns an iterator to the first redundant element at the end
of the container. These redundant elements must be removed using the
erase() method. This check warns when not all of the elements will be
removed due to using an inappropriate overload.

Reviewer: alexfh

Differential Revision: http://reviews.llvm.org/D7496

llvm-svn: 228679
2015-02-10 09:14:26 +00:00
Samuel Benzaquen b5cbe0100f Verify assign operator signatures.
Summary: Warn when the return type of assign operators is not Class&.

Reviewers: alexfh

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D6667

llvm-svn: 228583
2015-02-09 17:50:40 +00:00
Gabor Horvath 3880bee0ff [clang-tidy] Checker for inefficient use of algorithms on associative containers
Summary:
Associative containers implements some of the algorithms as methods which
should be preferred to the algorithms in the algorithm header. The methods
can take advantage of the order of the elements.

Reviewers: alexfh

Reviewed By: alexfh

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D7246

llvm-svn: 228505
2015-02-07 19:54:19 +00:00
Alexander Kornienko b6e1fde719 [clang-tidy] Don't ignore default set of checks when a config file is found.
Summary:
This makes clang-tidy merge the default set of checks with the one
provided in the configuration file instead of just using the checks from the
config file. This adds a way to modify the default set of checks while the
previous behavior required to always define the set of checks completely.

Reviewers: djasper

Reviewed By: djasper

Subscribers: curdeius, cfe-commits

Differential Revision: http://reviews.llvm.org/D7434

llvm-svn: 228298
2015-02-05 14:50:17 +00:00
Alexander Kornienko dd2dad0d24 [clang-tidy] Detect dependent initializer_lists in google-explicit-constructor.
Summary:
Detect constructors taking a single std::initializer_list even when it
is instantiation-dependent.

Reviewers: djasper

Reviewed By: djasper

Subscribers: curdeius, cfe-commits

Differential Revision: http://reviews.llvm.org/D7431

llvm-svn: 228289
2015-02-05 12:49:07 +00:00
Alexander Kornienko 78070fbae5 [clang-tidy] Fix some false positives in google-readability-casting
Summary:
Ignore C-style casts in extern "C" {} sections. Be more careful when
detecting redundant casts between typedefs to the same type - emit a more
specific warning and don't automatically fix them.

Reviewers: klimek

Reviewed By: klimek

Subscribers: curdeius, cfe-commits

Differential Revision: http://reviews.llvm.org/D7247

llvm-svn: 227444
2015-01-29 15:17:13 +00:00
Chris Bieneman fc4fd529c8 NFC. Migrating clang-tools-extra to the cl::HideUnrelatedOptions API.
llvm-svn: 227388
2015-01-28 22:45:26 +00:00
Pete Cooper 1d2f63a4ef Updated tools to match r227345 which changed the getRegisteredOptions method
llvm-svn: 227372
2015-01-28 21:34:05 +00:00
Alexander Kornienko e94b7c24c8 [clang-tidy] Use shrink_to_fit instead of copy and swap trick
The shrink_to_fit() method is more readable and more effective than
the copy and swap trick to reduce the capacity of a shrinkable container.
Note that, the shrink_to_fit() method is only available in C++11 and up.

Example:

std::vector<int>(v).swap(v); will be replaced with v.shrink_to_fit();

http://reviews.llvm.org/D7087

Patch by Gábor Horváth!

llvm-svn: 226912
2015-01-23 15:10:37 +00:00
Alexander Kornienko a6354cae56 [clang-tidy] Small readability-container-size-empty cleanup
Utilized the hasEitherOperand instead of explicit anyOf.

http://reviews.llvm.org/D7142

Patch by Gábor Horváth!

llvm-svn: 226911
2015-01-23 14:43:06 +00:00
Alexander Kornienko bf87a8b714 Replace size call with empty call where appripriate in clang/tools/extra
This patch is the result of applying fixes of the ContainerSizeEmpty Clang-Tidy
checker which was committed recently.

http://reviews.llvm.org/D7085

Patch by Gábor Horváth!

llvm-svn: 226817
2015-01-22 13:14:29 +00:00
Alexander Kornienko 96e7b8b0c9 [clang-tidy] Use actual LangOptions.
llvm-svn: 226812
2015-01-22 12:40:47 +00:00
Alexander Kornienko febfd3453e [clang-tidy] Minor cleanups in readability-container-size-empty checker
* Removed an unused header
  * Simplified the custom ast_matchers

http://reviews.llvm.org/D7088

Patch by Gábor Horváth!

llvm-svn: 226810
2015-01-22 12:27:09 +00:00
Alexander Kornienko 9115a3af02 [clang-tidy] Make ClangTidyOptionsProvider::getOptions return by value.
Returning by reference limits possible implementations and doesn't bring any
benefits as all callers make copies of the returned value anyway.

llvm-svn: 226553
2015-01-20 09:48:51 +00:00
Alexander Kornienko 4babd689f9 clang-tidy: 'size' call that could be replaced with 'empty' on STL containers
We are porting some of the checkers at a company we developed to the Clang Tidy
infrastructure. We would like to open source the checkers that may be useful
for the community as well. This patch is the first checker that is being ported
to Clang Tidy. We also added fix-it hints, and applied them to LLVM:
http://reviews.llvm.org/D6924

The code compiled and the unit tests are passed after the fixits was applied.

The documentation of the checker:

/// The emptiness of a container should be checked using the empty method
/// instead of the size method. It is not guaranteed that size is a
/// constant-time function, and it is generally more efficient and also shows
/// clearer intent to use empty. Furthermore some containers may implement the
/// empty method but not implement the size method. Using empty whenever
/// possible makes it easier to switch to another container in the future.

It also uses some custom ASTMatchers. In case you find them useful I can submit
them as separate patches to clang. I will apply your suggestions to this patch.

http://reviews.llvm.org/D6925

Patch by Gábor Horváth!

llvm-svn: 226172
2015-01-15 15:46:58 +00:00
Daniel Jasper 3b6018b9f6 clang-tidy: Add initial check for "Don't use else after return".
As per the LLVM coding standards:
http://llvm.org/docs/CodingStandards.html#don-t-use-else-after-a-return

Initial version, probably still quite a bit to do until this is really
useful.

Review: http://reviews.llvm.org/D6927
llvm-svn: 226025
2015-01-14 19:37:54 +00:00
Hans Wennborg 859ea8056d docs/conf.py: bump version to 3.7
llvm-svn: 226015
2015-01-14 18:32:20 +00:00
Chandler Carruth 3cbd71c03b [cleanup] Re-sort the #include lines with llvm/utils/sort_includes.py
No functionality changed, this is just a mechanical cleanup to keep the
order of #include lines consistent across the project.

llvm-svn: 225976
2015-01-14 11:24:38 +00:00
Daniel Jasper 0c7e93c128 Make LoopConvert work with containers that are used like arrays.
llvm-svn: 225629
2015-01-12 13:17:56 +00:00
Daniel Jasper 02c9153009 clang-tidy: [misc-use-override] Simplify regular expressions in test.
No functional changes.

llvm-svn: 225520
2015-01-09 14:10:15 +00:00
Daniel Jasper e73cfbf6ba clang-tidy: [misc-use-override] Fix 'override' insertion.
Before:
  void f() __attribute__((override unused))

After:
  void f() override __attribute__((unused))

llvm-svn: 225519
2015-01-09 13:56:35 +00:00
Alexander Kornienko 284c249a63 Fixed a typo in a comment. NFC.
llvm-svn: 224581
2014-12-19 15:37:02 +00:00
Richard Smith 2cf124a9f3 Update to match clang r223913.
llvm-svn: 223914
2014-12-10 03:10:06 +00:00