Commit Graph

1649 Commits

Author SHA1 Message Date
Miklos Vajna 617409f0c0 clang-rename: fix renaming heap allocations
The check failed, 'Cla *C = new Cla();' was renamed to 'D *C = new Cla();'.

Reviewers: klimek

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

llvm-svn: 271572
2016-06-02 20:00:22 +00:00
Samuel Benzaquen aa05ae91fb Fix uninitialized memory access when the token 'const' is not present in
the program.

If the token is not there, we still warn but we don't try to give a
fixit hint.

llvm-svn: 271426
2016-06-01 20:37:23 +00:00
Eric Liu 140b1fba91 [include-fixer] use includer of .inc header to be the file path of a symbol from .inc header.
Summary: added PathConfig.cpp and use includer of .inc header to be the file path of a symbol from .inc header.

Reviewers: bkramer

Subscribers: cfe-commits

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

llvm-svn: 271385
2016-06-01 12:01:06 +00:00
Haojian Wu 17a54e3618 [include-fixer] Use YAML format in -output-headers and -insert-header mode.
Summary:
And some improvements:
* Show better error messages on unfound symbols.
* Fix a typo.

Reviewers: bkramer

Subscribers: cfe-commits

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

llvm-svn: 271382
2016-06-01 11:43:10 +00:00
Eric Liu 74ccbd61af [include-fixer] disable path cleaning test for windows and mingw.
llvm-svn: 271321
2016-05-31 19:22:01 +00:00
Eric Liu 65cb39eb12 [find-all-symbols] remove dots in SymbolInfo file paths.
Summary: remove dots in SymbolInfo file paths.

Reviewers: bkramer, klimek

Subscribers: cfe-commits

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

llvm-svn: 271302
2016-05-31 17:37:38 +00:00
NAKAMURA Takumi e18fc2130d IncludeFixerTests: Update libdeps.
llvm-svn: 271295
2016-05-31 16:41:39 +00:00
Eric Liu 78985da8cc [include-fixer] removed unused forward declaration.
llvm-svn: 271294
2016-05-31 16:03:09 +00:00
Piotr Padlewski e93a73fb7a [ASTMatchers] Added ignoringParenImpCasts to has matchers
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
2016-05-31 15:26:56 +00:00
Eric Liu 516f18e515 [include-fixer] use clang-format cleaner to insert header.
Summary: clang-format's cleanupAroundReplacements() takes care of header insertions.

Reviewers: bkramer

Subscribers: cfe-commits, hokein

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

llvm-svn: 271287
2016-05-31 14:48:45 +00:00
Benjamin Kramer a3f3a7bdd8 [include-fixer] Inline trivial methods.
Putting them into the .cpp file is both more verbose and slower than
having them in the header. No functional change intended.

llvm-svn: 271285
2016-05-31 14:40:10 +00:00
Benjamin Kramer 99985b864b [include-fixer] Use a DenseMap, order doesn't matter here.
llvm-svn: 271284
2016-05-31 14:37:10 +00:00
Benjamin Kramer 658d28014b [include-fixer] Rank symbols based on the number of occurrences we found while merging.
This sorts based on the popularity of the header, not the symbol. If
there are mutliple matching symbols in one header we take the maximum
popularity for that header and deduplicate. If we know nothing we sort
lexicographically based on the header path.

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

llvm-svn: 271283
2016-05-31 14:33:28 +00:00
Eric Liu f83187deb9 [include-fixer] use tooling::Replacements since the order of replacements don't matter anymore.
Summary: [include-fixer] use tooling::Replacements since the order of replacements don't matter anymore.

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

llvm-svn: 271279
2016-05-31 13:52:59 +00:00
Haojian Wu eb6ce0643d [include-fixer] Code cleanup.
Summary:
* Abstract the DB setting code to a function.
* Remove the unused FallbackStyle.

Reviewers: bkramer

Subscribers: cfe-commits

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

llvm-svn: 271273
2016-05-31 13:23:00 +00:00
Benjamin Kramer 03016b85b6 [find-all-symbols] Add a test to make sure merging actually works.
llvm-svn: 271270
2016-05-31 12:12:19 +00:00
Eric Liu c893070ff1 [include-fixer] collect the number of times a symbols is found in an indexing run and use it for symbols popularity ranking.
Summary:
[include-fixer] collect the number of times a symbols is found in an
indexing run and use it for symbols popularity ranking.

Reviewers: bkramer

Subscribers: cfe-commits, hokein, djasper

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

llvm-svn: 271268
2016-05-31 12:01:48 +00:00
Benjamin Kramer 8f961aab25 Make the vim integration output a bit prettier and drop the -debug flag.
llvm-svn: 271266
2016-05-31 11:28:34 +00:00
Haojian Wu e3801b0023 [include-fixer] Add missing dependency.
llvm-svn: 271261
2016-05-31 10:06:12 +00:00
Haojian Wu 11e9bd2450 [include-fixer] Create a mode in vim integration to show multiple potential headers.
Summary:
Some changes in the patch:

* Add two commandline flags in clang-include-fixer.
* Introduce a IncludeFixerContext for the queried symbol.
* Pull out CreateReplacementsForHeader.

Reviewers: bkramer

Subscribers: klimek, cfe-commits, ioeric

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

llvm-svn: 271258
2016-05-31 09:31:51 +00:00
Felix Berger 98e4019a58 [clang-tidy] UnnecessaryCopyInitialization - Extend to trigger on non-const "this" object argument if it is not modified.
Summary:

Also trigger the check in the following case:

void foo() {
  ExpensiveToCopy Obj;
  const auto UnnecessaryCopy = Obj.constReference();
  Obj.onlyUsedAsConst();
}

i.e. when the object the method is called on is not const but is never
modified.

Reviewers: alexfh, fowles

Subscribers: cfe-commits

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

llvm-svn: 271239
2016-05-31 00:25:57 +00:00
Etienne Bergeron 6885229cb8 [clang-tidy] Remove redundant quote in add_new_check script
Summary:
Remove redundant quote.
These quotes were added here: http://reviews.llvm.org/D20766

Reviewers: bkramer

Subscribers: cfe-commits

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

llvm-svn: 271210
2016-05-30 15:42:08 +00:00
Etienne Bergeron 1c51a2d1d4 [clang-tidy] Fix script adding new clang-tidy check
Summary:
The `getName()` call is useless. It's better to show a better example
as tutorial.

Reviewers: alexfh

Subscribers: cfe-commits

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

llvm-svn: 271207
2016-05-30 15:05:10 +00:00
Haojian Wu 3b9f4cf462 Fix a wrong check in misc-unused-using-decls
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
2016-05-30 07:42:22 +00:00
Benjamin Kramer bc90075629 [include-fixer] Add a missing .h.
llvm-svn: 270989
2016-05-27 12:49:58 +00:00
NAKAMURA Takumi 201c955fbc clang-tools-extra/test/clang-tidy/cppcoreguidelines-pro-type-vararg.cpp: Tweak for r270775.
llvm-svn: 270841
2016-05-26 11:20:54 +00:00
Samuel Benzaquen 7663d3be15 Speed up check by using a recursive visitor.
Summary:
Use a recursive visitor instead of forEachDescendant() matcher.
The latter requires several layers of virtual function calls for each node and
it is more expensive than the visitor.
Benchmark results show improvement of ~6% walltime in clang-tidy.

Reviewers: alexfh

Subscribers: cfe-commits

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

llvm-svn: 270714
2016-05-25 16:19:23 +00:00
Eric Liu fff1335fce [include-fixer] /usr/include/xlocal.h to include/xlocal.h in hardcoded map.
llvm-svn: 270703
2016-05-25 14:17:09 +00:00
Benjamin Kramer 0e871f0b66 Include local header with quotes instead of angle brackets.
This works by accident because we pass '-I.'

llvm-svn: 270701
2016-05-25 14:14:52 +00:00
Haojian Wu 218febb8eb [include-fixer] Simplify the code since we won't handle multiple includes at once.
Reviewers: bkramer

Subscribers: cfe-commits

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

llvm-svn: 270700
2016-05-25 14:06:12 +00:00
Eric Liu 748308ad35 [include-fixer] moved STLPostfixMap into findAllSymbols library and make it a static variable in function.
Summary: [include-fixer] moved STLPostfixMap into findAllSymbols library and make it a static variable in function.

Reviewers: bkramer

Subscribers: cfe-commits

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

llvm-svn: 270696
2016-05-25 13:53:33 +00:00
Benjamin Kramer c85e14e0d6 [clang-tidy] Fix typo in test file name.
polo

llvm-svn: 270682
2016-05-25 09:44:35 +00:00
Miklos Vajna 10e25748b0 clang-rename: fix renaming non-members variables when referenced as macro arguments
The second check failed, FOO(C::X) wasn't renamed to FOO(C::Y).

Reviewers: klimek

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

llvm-svn: 270599
2016-05-24 19:08:53 +00:00
Benjamin Kramer e78ace55df [clang-tidy] Don't rely on <array> being available.
The STL isn't necessarily around when running tests. Make our own fake
std::array to test this.

llvm-svn: 270581
2016-05-24 16:54:26 +00:00
Eric Liu 54b68779b2 [include-fixer][find-all-symbols] added missing dependencies.
llvm-svn: 270578
2016-05-24 16:35:24 +00:00
Mads Ravn ef88dc8fe4 [clang-tidy] modernize-pass-by-value bugfix. Reverting lit-style test
Adding to revision 270567. The lit-style test was wrong. This is being fixed by this commit.

This is the bug on bugzilla: https://llvm.org/bugs/show_bug.cgi?id=27731

This is the code review on phabricator: http://reviews.llvm.org/D20365

llvm-svn: 270575
2016-05-24 16:09:24 +00:00
Eric Liu 0a28e680f7 [include-fixer][find-all-symbols] removed unused const member from YamlReporter to fix build bot failure.
llvm-svn: 270571
2016-05-24 15:34:37 +00:00
Mads Ravn 28cc243930 [clang-tidy] modernize-pass-by-value bugfix. Reverting lit-style test
Adding to revision 270565. The lit-style test was wrong. This is being fixed by this commit.

This is the bug on bugzilla: https://llvm.org/bugs/show_bug.cgi?id=27731

This is the code review on phabricator: http://reviews.llvm.org/D20365

llvm-svn: 270567
2016-05-24 15:13:44 +00:00
Eric Liu a7d19414da [find-all-symbols] Added hardcode header mapping from header postfix to header name for STL symbols.
Summary: [find-all-symbols] Added hardcode header mapping from header postfix to header name for STL symbols.

Reviewers: klimek, bkramer

Subscribers: cfe-commits, hokein

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

llvm-svn: 270566
2016-05-24 15:10:58 +00:00
Mads Ravn 7175c2ce4d [clang-tidy] modernize-pass-by-value bugfix
Modified the clang-tidy PassByValue check. It now stops adding std::move to type which is trivially copyable because that caused the clang-tidy MoveConstArg to complain and revert, thus creating a cycle.

I have also added a lit-style test to verify the bugfix.

This is the bug on bugzilla: https://llvm.org/bugs/show_bug.cgi?id=27731

This is the code review on phabricator: http://reviews.llvm.org/D20365

llvm-svn: 270565
2016-05-24 15:00:16 +00:00
Mads Ravn 86d5f8ad4c Commiting for http://reviews.llvm.org/D20365
llvm-svn: 270473
2016-05-23 18:27:05 +00:00
Mads Ravn dfa3b3d3ee Commiting for http://reviews.llvm.org/D20365
llvm-svn: 270472
2016-05-23 18:15:40 +00:00
Mads Ravn d01743a3f7 Commiting for http://reviews.llvm.org/D20365
llvm-svn: 270470
2016-05-23 18:06:29 +00:00
Alexander Kornienko 1c6d827015 Fix docs
llvm-svn: 270288
2016-05-20 22:42:03 +00:00
Alexander Kornienko 5d08bb72d9 [clang-tidy] Switch to a more common way of customizing check behavior.
This should have been done this way from the start, however I somehow missed
r257177.

llvm-svn: 270215
2016-05-20 13:42:40 +00:00
Haojian Wu cc0c10e300 [find-all-symbols] Some cleanups in unittest.
llvm-svn: 270211
2016-05-20 12:47:56 +00:00
Haojian Wu a23ac3d249 [find-all-symbol] Ignore inline namespace context.
Reviewers: bkramer

Subscribers: cfe-commits, ioeric

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

llvm-svn: 270206
2016-05-20 12:04:56 +00:00
Miklos Vajna ed28d41b1a clang-rename: fix renaming members when referenced as macro arguments
The second check failed, FOO(C.X) wasn't renamed to FOO(C.Y).

Reviewers: klimek

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

llvm-svn: 270204
2016-05-20 11:43:59 +00:00
Eric Liu 6c9472c57f [find-all-symbols] fix failing unittest for Windows build bot.
llvm-svn: 270202
2016-05-20 11:14:36 +00:00
Haojian Wu 20dec208e9 [find-all-symbol] Try to fix the failure windows unittest.
llvm-svn: 270199
2016-05-20 10:36:53 +00:00