Commit Graph

2275 Commits

Author SHA1 Message Date
Alexander Kornienko 762adef1a9 [clang-tidy] Ignore spaces between globs in the Checks option.
llvm-svn: 295303
2017-02-16 10:23:18 +00:00
Jonas Devlieghere f9e7b3caba [clang-tidy] Fix test modernize-return-braced-init-list
llvm-svn: 295207
2017-02-15 17:37:58 +00:00
Jonas Devlieghere 0a6913bc2f Fixed indentation issue in release notes
llvm-svn: 295205
2017-02-15 17:19:44 +00:00
Jonas Devlieghere 2789043178 [clang-tidy] Add check 'modernize-return-braced-init-list'
Summary:
Replaces explicit calls to the constructor in a return with a braced
initializer list. This way the return type is not needlessly duplicated in the
return type and the return statement.

```
Foo bar() {
  Baz baz;
  return Foo(baz);
}

// transforms to:

Foo bar() {
  Baz baz;
  return {baz};
}
```

Reviewers: hokein, Prazek, aaron.ballman, alexfh

Reviewed By: Prazek, aaron.ballman, alexfh

Subscribers: malcolm.parsons, mgorny, cfe-commits

Tags: #clang-tools-extra

Differential Revision: https://reviews.llvm.org/D28768

llvm-svn: 295199
2017-02-15 17:06:06 +00:00
Benjamin Kramer 0ac6d124cf [clangd] Fix another use after free that I missed because COW strings.
llvm-svn: 295198
2017-02-15 17:04:57 +00:00
Benjamin Kramer fbe32f59c2 [clangd] Silence GCC warning about falling off a fully covered switch.
llvm-svn: 295196
2017-02-15 16:58:44 +00:00
Benjamin Kramer e14bd4246d [clangd] Synchronize logs access.
I don't think that this is necessary for correctness, but makes tsan
much more useful.

llvm-svn: 295194
2017-02-15 16:44:11 +00:00
Benjamin Kramer 3858b7d6e9 [clangd] Initialize the thread after the mutex.
Otherwise locking the mutex yields a racy assertion failure on picky
implementations.

llvm-svn: 295193
2017-02-15 16:34:58 +00:00
Malcolm Parsons a3bc480455 [clang-tidy] Don't delay parsing of templates in test for misc-unconventional-assign-operator
llvm-svn: 295192
2017-02-15 16:32:55 +00:00
Benjamin Kramer 4eaf89f2d9 [clangd] Fix use after free.
llvm-svn: 295187
2017-02-15 15:56:14 +00:00
Benjamin Kramer 22abde7860 [clangd] Add missing include.
llvm-svn: 295184
2017-02-15 15:19:13 +00:00
Benjamin Kramer 4486a6c4c7 [clangd] Wire up ASTUnit and publish diagnostics with it.
Summary:
This requires an accessible compilation database. The parsing is done
asynchronously on a separate thread.

Reviewers: klimek, krasimir

Subscribers: cfe-commits, mgorny

Differential Revision: https://reviews.llvm.org/D29886

llvm-svn: 295180
2017-02-15 15:04:20 +00:00
Haojian Wu ead59eeade [clang-tidy] Ignore instantiated functions and static data members of classes in misc-definitions-in-headers.
Reviewers: alexfh

Reviewed By: alexfh

Subscribers: JDevlieghere, cfe-commits

Differential Revision: https://reviews.llvm.org/D29957

llvm-svn: 295178
2017-02-15 14:10:50 +00:00
Malcolm Parsons 51642f9d0a [clang-tidy] Don't warn about call to unresolved operator*
Summary:
The misc-unconventional-assign-operator check had a false positive
warning when the 'operator*' in 'return *this' was unresolved.

Change matcher to allow calls to unresolved operator.

Fixes PR31531.

Reviewers: alexfh, aaron.ballman

Subscribers: JDevlieghere, cfe-commits

Differential Revision: https://reviews.llvm.org/D29393

llvm-svn: 295176
2017-02-15 14:01:41 +00:00
Benjamin Kramer d1013b44e3 [clang-tidy] Add support for NOLINTNEXTLINE.
Reviewers: alexfh

Subscribers: JDevlieghere, cfe-commits

Differential Revision: https://reviews.llvm.org/D29899

llvm-svn: 295049
2017-02-14 12:47:56 +00:00
Haojian Wu be2588fa7f [clang-tidy] Improve diagnostic message for misc-definitions-in-header.
Summary:
Users might get confused easily when they see the check's message on
full template function speciliations.

Add a note to the output message, which mentions these kind of function
specializations are treated as regular functions.

Reviewers: alexfh

Reviewed By: alexfh

Subscribers: JDevlieghere, cfe-commits

Differential Revision: https://reviews.llvm.org/D29928

llvm-svn: 295048
2017-02-14 12:39:22 +00:00
Gabor Horvath e647bd59f6 [clang-tidy] Add readability-misleading-indentation check.
Differential Revision: https://reviews.llvm.org/D19586

llvm-svn: 295041
2017-02-14 10:03:27 +00:00
Benjamin Kramer 19f2403d3b [clang-tidy] Reduce indentation. NFC.
llvm-svn: 294974
2017-02-13 18:03:10 +00:00
Eric Liu a13c419a29 [change-namespace] add an option to dump changed files in YAML.
Reviewers: hokein

Reviewed By: hokein

Subscribers: fhahn, cfe-commits

Differential Revision: https://reviews.llvm.org/D29893

llvm-svn: 294969
2017-02-13 17:24:14 +00:00
Mads Ravn 183e9644b9 [clang-tidy] Fix for bug 31838: readability-delete-null-pointer does not work for class members
Fix for commit r294912 which had a small error in the AST matcher.

llvm-svn: 294913
2017-02-12 20:35:42 +00:00
Mads Ravn 6ff978fd54 [clang-tidy] Fix for bug 31838: readability-delete-null-pointer does not work for class members
I have made a small fix for readability-delete-null-pointer check so it also checks for class members.

Example of case that it fixes
```
  struct A {
    void foo() {
      if(mp)
        delete mp;
    }
    int *mp;
  };
```

Reviewers: JDevlieghere, aaron.ballman, alexfh, malcolm.parsons

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D29726

llvm-svn: 294912
2017-02-12 20:09:59 +00:00
David Blaikie a67cf0001f Fix memory leak by using unique_ptr
llvm-svn: 294823
2017-02-11 05:25:21 +00:00
Benjamin Kramer e15fe37506 [clangd] Move isDone from the JSONOutput to ShutdownHandler.
This is just as easy to check from main but prevents random code from
shutting down the server.

llvm-svn: 294760
2017-02-10 17:25:38 +00:00
Alexander Kornienko 01496fe455 [clang-tidy] Fix handling of function types in google-readability-casting
llvm-svn: 294751
2017-02-10 14:57:19 +00:00
Benjamin Kramer d0b2ccd219 [clangd] Refactor stream output into a single thread-safe output object.
This abstracts away the passing of raw_ostreams everywhere, thread
safety will be used soon.

llvm-svn: 294747
2017-02-10 14:08:40 +00:00
Eric Fiselier 87c87f4c30 [CMake] Fix pthread handling for out-of-tree builds
LLVM defines `PTHREAD_LIB` which is used by AddLLVM.cmake and various projects
to correctly link the threading library when needed. Unfortunately
`PTHREAD_LIB` is defined by LLVM's `config-ix.cmake` file which isn't installed
and therefore can't be used when configuring out-of-tree builds. This causes
such builds to fail since `pthread` isn't being correctly linked.

This patch attempts to fix that problem by renaming and exporting
`LLVM_PTHREAD_LIB` as part of`LLVMConfig.cmake`. I renamed `PTHREAD_LIB`
because It seemed likely to cause collisions with downstream users of
`LLVMConfig.cmake`.

llvm-svn: 294690
2017-02-10 01:59:20 +00:00
David L. Jones dc54df9ca2 Adds the commandline need to run clang-tidy tests.
Patch by Jorge Gorbe (lethalantidote)

Differential Revision: https://reviews.llvm.org/D29737

llvm-svn: 294689
2017-02-10 01:48:43 +00:00
Hans Wennborg f4166bf0ee Don't try to link to the 4.0 release notes
llvm-svn: 294657
2017-02-09 23:25:52 +00:00
Ehsan Akhgari b7418d3b4a [clang-tidy] Add -quiet option to suppress extra output
Summary:
This new flag instructs clang-tidy to not output anything
except for errors and warnings.  This makes it easier to
script clang-tidy to run as part of external build systems.

Reviewers: bkramer, alexfh, klimek

Subscribers: JDevlieghere, cfe-commits

Differential Revision: https://reviews.llvm.org/D29661

llvm-svn: 294607
2017-02-09 18:32:02 +00:00
Alexander Kornienko 28239b166f [clang-tidy] Fix misc-unused-using-decls false positives in presence of compile errors
llvm-svn: 294578
2017-02-09 10:41:27 +00:00
Ehsan Akhgari 3bceebb0e0 [clang-tidy] Add -extra-arg and -extra-arg-before to clang-tidy-diff.py
Summary:
These flags allow specifying extra arguments to the tool's command
line which don't appear in the compilation database.

Reviewers: alexfh, klimek, bkramer

Subscribers: JDevlieghere, cfe-commits

Differential Revision: https://reviews.llvm.org/D29699

llvm-svn: 294491
2017-02-08 17:50:24 +00:00
Alexander Kornienko 385c2a3134 [clang-tidy] hasErrorOccurred() -> hasUncompilableErrorOccurred()
hasErrorOccurred() -> hasUncompilableErrorOccurred(), since we only care about
errors that lead to invalid AST.

llvm-svn: 294467
2017-02-08 16:11:22 +00:00
Alexander Kornienko bb64200e16 [clang-tidy] Supresses misc-move-constructor-init warning for const fields.
Patch by CJ DiMeglio!

Differential revision: https://reviews.llvm.org/D28973

llvm-svn: 294459
2017-02-08 14:56:16 +00:00
Benjamin Kramer f86708dbf5 [clangd] Strip file:// from the URI when calling formatting.
It confuses FileManager on windows.

llvm-svn: 294314
2017-02-07 16:10:17 +00:00
Benjamin Kramer d115a574b5 [clangd] Ignore comments in clangd input, so we can write tests without sed.
Another attempt on making this work on windows.

llvm-svn: 294312
2017-02-07 15:37:17 +00:00
Benjamin Kramer 81f91c1777 [clangd] Fix subtle use after return.
I didn't find this because my main development machine still happens to
use libstdc++ with the broken C++11 ABI, which has a global empty
string.

llvm-svn: 294309
2017-02-07 14:35:09 +00:00
Simon Pilgrim 24f1d340b3 Disable test on windows buildbots without shell support
llvm-svn: 294299
2017-02-07 13:08:22 +00:00
Benjamin Kramer 6a3d74eb50 [clangd] Set stdin to binary to fix tests on windows.
llvm-svn: 294297
2017-02-07 12:40:59 +00:00
Benjamin Kramer d588b0f525 [clangd] Harden test against sed implementations that strip \r.
Also clean up logging and don't print \0.

llvm-svn: 294294
2017-02-07 11:49:03 +00:00
Alexander Kornienko 258d9a528e [clang-tidy] misc-argument-comment - extended gmock support
It looks like direct calls to mocked methods happen in the wild. This patch
add support for these as well.

llvm-svn: 294293
2017-02-07 11:39:56 +00:00
Benjamin Kramer 59542bb08a [clangd] Add missing include.
llvm-svn: 294292
2017-02-07 10:47:40 +00:00
Benjamin Kramer bb1cdb63e5 Add a prototype for clangd
clangd is a language server protocol implementation based on clang. It's
supposed to provide editor integration while not suffering from the
confined ABI of libclang.

This implementation is limited to the bare minimum functionality of
doing (whole-document) formatting and rangeFormatting. The JSON parsing
is based on LLVM's YAMLParser but yet most of the code of clangd is
currently dealing with JSON serialization and deserialization.

This was only tested with VS Code so far, mileage with other LSP clients
may vary.

Differential Revision: https://reviews.llvm.org/D29451

llvm-svn: 294291
2017-02-07 10:28:20 +00:00
Jonathan Coe 5f1a2c2e0a [clang-tidy] Cleanup of no-assembler check
Address outstanding comments from https://reviews.llvm.org/D29267

llvm-svn: 294283
2017-02-07 06:19:38 +00:00
Jonathan Coe 3032d3c3f3 [clang-tidy] safety-no-assembler
Summary:
Add a new clang-tidy module for safety-critical checks.

Include a check for inline assembler.

Reviewers: Prazek, dtarditi, malcolm.parsons, alexfh, aaron.ballman, idlecode

Reviewed By: idlecode

Subscribers: idlecode, JonasToth, Eugene.Zelenko, mgorny, JDevlieghere, cfe-commits

Tags: #clang-tools-extra

Differential Revision: https://reviews.llvm.org/D29267

llvm-svn: 294255
2017-02-06 22:57:14 +00:00
Alexander Kornienko d9fa4e95ec [clang-tidy] misc-argument-comment support for gmock
Now for real. The use case supported previously is used by approximately nobody.
What's needed is support for matching argument comments in EXPECT_xxx calls to
the names of parameters of the mocked methods.

llvm-svn: 294193
2017-02-06 15:47:17 +00:00
Alexander Kornienko 2d73022122 [clang-tidy] getPreviousNonCommentToken -> getPreviousToken
llvm-svn: 294192
2017-02-06 15:46:33 +00:00
Eric Liu 28c30ce250 [change-namespace] trying to fix build bot failure caused by r293909.
llvm-svn: 293927
2017-02-02 19:46:12 +00:00
Eric Liu 0325a77c5b [change-namespace] fix unscoped enum constant references.
Reviewers: bkramer

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D29460

llvm-svn: 293909
2017-02-02 17:40:38 +00:00
Eric Liu ae7de7117a [change-namespace] check using shadow decl correctly when shortening namespace specifiers.
Summary:
This fixes mismatch between template decls and template specialization decls.

Also added a few more test cases.

Reviewers: bkramer

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D29447

llvm-svn: 293897
2017-02-02 15:29:54 +00:00
Alexander Kornienko 73c69a3714 [clang-tidy] misc-argument-comment support for gmock
llvm-svn: 293845
2017-02-02 00:37:08 +00:00
Alexander Kornienko 165fe63b4e [clang-tidy] misc-argument-comment: ignore comments after arguments
llvm-svn: 293771
2017-02-01 15:28:25 +00:00
Alexander Kornienko b7a6ea3049 [clang-tidy] Remove debug logging.
llvm-svn: 293763
2017-02-01 12:41:34 +00:00
Diana Picus 9141501721 Revert "Implement a new clang-tidy check that suggests users replace dynamic exception specifications with noexcept exception specifications."
This reverts commit r293217, its follow-up 293218 and part of 293234 because it
broke all bots that build clang-tools-extra.

llvm-svn: 293267
2017-01-27 07:19:22 +00:00
Eugene Zelenko 834bb0e3b5 [Clang-tidy documentation] Consistency (fix-it); 80 characters per line.
llvm-svn: 293234
2017-01-26 23:58:21 +00:00
Aaron Ballman abb5b7965a Correcting a typo in the test case to appease bots.
llvm-svn: 293218
2017-01-26 22:39:01 +00:00
Aaron Ballman 8ec373af3d Implement a new clang-tidy check that suggests users replace dynamic exception specifications with noexcept exception specifications.
Patch by Don Hinton.

llvm-svn: 293217
2017-01-26 22:34:24 +00:00
Eric Liu 9122916ee5 [change-namespace] correctly shorten namespace when references have leading '::'
Reviewers: bkramer

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D29182

llvm-svn: 293187
2017-01-26 16:31:32 +00:00
Eric Liu bc715504da [change-namespace] add leading '::' to references in new namespace when name conflict is possible.
Summary:
For example, when we change 'na' to "nb::nc", we need to add leading '::' to
references "::nc::X" in the changed namespace.

Reviewers: bkramer

Reviewed By: bkramer

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D29176

llvm-svn: 293182
2017-01-26 15:08:44 +00:00
Gabor Horvath 3ac2ad7d6c [clang-tidy] Don't modernize-raw-string-literal if replacement is longer.
Fixes PR30964. The old behavior can be achieved using a setting.

Patch by: Andras Leitereg!

Differential Revision: https://reviews.llvm.org/D28667

llvm-svn: 292938
2017-01-24 15:18:11 +00:00
Alexander Kornienko 2e888fe165 [clang-tidy] Fix NOLINT test
Summary:
Test cases I've added in review D26218 were too brittle and weren't working properly.
This patch fixes this.

Reviewers: alexfh

Reviewed By: alexfh

Subscribers: cfe-commits

Patch by Nikita Kakuev!

Differential Revision: https://reviews.llvm.org/D26466

llvm-svn: 292926
2017-01-24 12:42:26 +00:00
Alexander Kornienko 4b1dfbbc78 [clang-tidy] Avoid incorrect fixes in modernize-use-using
Avoid fixes for typedefs with multiple types and for typedefs with struct
definitions. Partially addresses http://llvm.org/PR28334

llvm-svn: 292918
2017-01-24 11:41:02 +00:00
Alexander Kornienko c456e686a9 [clang-tidy] Add more tests for modernize-use-using.
llvm-svn: 292917
2017-01-24 11:40:23 +00:00
Malcolm Parsons 3de05a2fda [clang-tidy] Ignore implicit functions in performance-unnecessary-value-param
Summary:
The performance-unnecessary-value-param check mangled inherited
constructors, as the constructors' parameters do not have useful source
locations. Fix this by ignoring implicit functions.

Fixes PR31684.

Reviewers: flx, alexfh, aaron.ballman

Subscribers: madsravn, JDevlieghere, cfe-commits

Differential Revision: https://reviews.llvm.org/D29018

llvm-svn: 292786
2017-01-23 13:18:08 +00:00
Felix Berger 08df246407 [clang-tidy] Do not trigger move fix for non-copy assignment operators in performance-unnecessary-value-param check
Reviewers: alexfh, sbenza, malcolm.parsons

Subscribers: JDevlieghere, cfe-commits

Differential Revision: https://reviews.llvm.org/D28899

llvm-svn: 292491
2017-01-19 15:51:10 +00:00
Malcolm Parsons 9cfb973ab4 [docs] Tell Doxygen to expand LLVM_ALIGNAS to nothing
Summary:
Docs for clang::Decl and clang::TemplateSpecializationType have
not been generated since LLVM_ALIGNAS was added to them.

Tell Doxygen to expand LLVM_ALIGNAS to nothing as described at
https://www.stack.nl/~dimitri/doxygen/manual/preprocessing.html

Reviewers: aaron.ballman, klimek, alexfh

Subscribers: ioeric, cfe-commits

Differential Revision: https://reviews.llvm.org/D28850

llvm-svn: 292484
2017-01-19 13:38:19 +00:00
Ehsan Akhgari 221ab77ff7 [clang-tidy] Add -extra-arg and -extra-arg-before to run-clang-tidy.py
Summary:
These flags allow specifying extra arguments to the tool's command
line which don't appear in the compilation database.

Reviewers: alexfh

Differential Revision: https://reviews.llvm.org/D28334

llvm-svn: 292415
2017-01-18 17:49:35 +00:00
Benjamin Kramer 1d3a91a682 [include-fixer] Don't return a correction if the header insertion failed.
This is could happen in cases involving macros and we don't want to
return an invalid fixit for it or a confusing error message with no
fixit.

llvm-svn: 292405
2017-01-18 16:22:58 +00:00
Alexander Kornienko 0d7a7cdb28 [clang-tidy] Fix crash in modernize-use-using (http://llvm.org/PR29135)
llvm-svn: 292229
2017-01-17 16:14:03 +00:00
Haojian Wu 903d35e50e Remove dead code.
llvm-svn: 292218
2017-01-17 13:46:59 +00:00
Haojian Wu 4775ce56ec [clang-move] Handle helpers with forward declarations.
Reviewers: ioeric

Reviewed By: ioeric

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D28801

llvm-svn: 292215
2017-01-17 13:22:37 +00:00
Haojian Wu b3d9888449 [clang-move] Ignore using decls which are defined in macros.
Summary:
Also ignore helpers which are defined in macro. Currently clang-move doesn't
handle macro well enough, especiall for complex macros. This patch will ignore
declarations in macros to make the behavior of clang-move more correct.

Reviewers: ioeric

Reviewed By: ioeric

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D28774

llvm-svn: 292207
2017-01-17 10:08:11 +00:00
Antonio Maiorano 0d7d9c20a5 Update tools to use new getStyle API
Depends on https://reviews.llvm.org/D28081

Differential Revision: https://reviews.llvm.org/D28315

llvm-svn: 292175
2017-01-17 00:13:32 +00:00
Haojian Wu 85867727fa [clang-move] Dump enum and type alias declarations.
Reviewers: ioeric

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D28293

llvm-svn: 292098
2017-01-16 09:34:07 +00:00
Malcolm Parsons e65b1029ca Remove unused lambda captures. NFC
llvm-svn: 291941
2017-01-13 19:02:50 +00:00
Malcolm Parsons 3c3ae0e6db Remove unused lambda captures. NFC
llvm-svn: 291940
2017-01-13 18:56:04 +00:00
Benjamin Kramer 5f1f6eceb3 Fix the build of the include-fixer plugin for some shared cmake builds and MSVC.
- The include fixer plugin does not directly depend on pthread, but can
pick up pthread references transitively through inlining. Just add
pthreads to the linked libs unconditionally.
- MSVC emits bogus warnings when including <future> and building without
exceptions. Blacklist the warnings explicitly.

llvm-svn: 291892
2017-01-13 10:14:07 +00:00
Hans Wennborg 07e66ad7f8 Clear the release notes for 5.0.0
llvm-svn: 291838
2017-01-12 21:58:40 +00:00
Hans Wennborg 73c01543ec Update docs/conf.py version
llvm-svn: 291832
2017-01-12 21:42:38 +00:00
Malcolm Parsons 6b3e27219e [clang-tidy] Fix check for trivially copyable types in modernize-pass-by-value
Summary:
rL270567 excluded trivially copyable types from being moved by
modernize-pass-by-value, but it didn't exclude references to them.
Change types used in the tests to not be trivially copyable.

Reviewers: madsravn, aaron.ballman, alexfh

Subscribers: JDevlieghere, cfe-commits

Differential Revision: https://reviews.llvm.org/D28614

llvm-svn: 291796
2017-01-12 19:20:35 +00:00
Alexander Kornienko e3d91a5c4b Correctly classify main file includes if there is a prefix added
Summary:
Prevents misclassifying includes based on the command-line filename (e.g. if a project is in a subdirectory).

This is slightly more robust than the additional duplicate detection, however the current classification scheme is still kind of brittle for a lot of code.

Reviewers: hokein, alexfh

Subscribers: cfe-commits, #clang-tools-extra

Patch by Julian Bangert!

Differential Revision: https://reviews.llvm.org/D26015

llvm-svn: 291767
2017-01-12 15:31:50 +00:00
Haojian Wu ffdd072858 [find-all-symbols] Index partial template specializations.
Summary:
Fix no std::function index.

Previously, we don't index all the template specialization declarations of functions and classes (Because we assume that template functions/classes are indexed by their template declarations), but this is not always true in some cases like `std::function` which only has a partial template specialization declaration.

Reviewers: ioeric, bkramer

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D27920

llvm-svn: 291669
2017-01-11 11:47:44 +00:00
Manuel Klimek a47515ec4a Improve include fixer's ranking by taking the paths into account.
Instead of just using popularity, we also take into account how similar the
path of the current file is to the path of the header.
Our first approach is to get popularity into a reasonably small scale by taking
log2 (which is roughly intuitive to how humans would bucket popularity), and
multiply that with the number of matching prefix path fragments of the included
header with the current file.
Note that currently we do not take special care for unclean paths containing
"../" or "./".

Differential Revision: https://reviews.llvm.org/D28548

llvm-svn: 291664
2017-01-11 10:32:47 +00:00
Manuel Klimek f38d74e78b Only launch asynchronously if threading is enabled.
llvm-svn: 291653
2017-01-11 07:20:46 +00:00
Benjamin Kramer bdb2171c15 [include-fixer] Load symbol index asynchronously.
We don't actually need the index until parse time, so fetch it in the
background and start parsing. By the time it is actually needed it's
likely that the loading phase has completed in the background.

llvm-svn: 291446
2017-01-09 15:18:28 +00:00
David Blaikie e83806be32 Reapply "Fix for shared_ptrification in Clang"
Aleksey Shlyapnikov pointed out the memory leak I'd introduced, so
recommitted the clang change with a fix for that.

This reapplies r291186, reverted in r291251.

llvm-svn: 291272
2017-01-06 19:49:09 +00:00
David Blaikie 2376c392f7 Revert "Fix for shared_ptrification in Clang"
The original commit caused an asan-detected memory leak in Clang.
Reverting while I investigate.

This reverts commit r291186.

llvm-svn: 291251
2017-01-06 17:47:19 +00:00
David Blaikie 201f0f5502 Fixes for Clang API change
llvm-svn: 291203
2017-01-06 01:09:06 +00:00
David Blaikie d02498c6ad Fix for shared_ptrification in Clang
llvm-svn: 291186
2017-01-05 22:44:07 +00:00
Malcolm Parsons b744ce87fc [clang-tidy] Ignore default arguments in modernize-default-member-init
Summary:
Default member initializers cannot refer to constructor parameters, but modernize-default-member-init was trying to when the default constructor had default arguments.

Change the check to ignore default arguments to the default constructor.

Fixes PR31524.

Reviewers: alexfh, aaron.ballman

Subscribers: cfe-commits, JDevlieghere, Eugene.Zelenko

Differential Revision: https://reviews.llvm.org/D28287

llvm-svn: 290972
2017-01-04 17:33:55 +00:00
Haojian Wu d69d90753c [clang-move] Support moving type alias declarations.
Reviewers: ioeric

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D28279

llvm-svn: 290967
2017-01-04 14:50:49 +00:00
Eric Liu ee5104bbab [change-namespace] get newlines around moved namespace right.
Summary: Previously, a `\n` might be left in the old namespace and thus not copied to the new namespace, which is bad.

Reviewers: hokein

Subscribers: alexshap, cfe-commits

Differential Revision: https://reviews.llvm.org/D28282

llvm-svn: 290966
2017-01-04 14:49:08 +00:00
Alexander Kornienko 563de799e3 [clang-tidy] Add check name to YAML export (clang-tools-extra part)
Add a field indicating the associated check for every replacement to the YAML
report generated with the '-export-fixes' option.  Update
clang-apply-replacements to handle the new format.

Patch by Alpha Abdoulaye!

Differential revision: https://reviews.llvm.org/D26137

llvm-svn: 290893
2017-01-03 14:36:13 +00:00
Haojian Wu 32a552f6b0 [clang-move] Support moving enum declarations.
Reviewers: ioeric

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D28228

llvm-svn: 290891
2017-01-03 14:22:25 +00:00
Malcolm Parsons cfa7d3748e [clang-tidy] Handle constructors in performance-unnecessary-value-param
Summary:
modernize-pass-by-value doesn't warn about value parameters that
cannot be moved, so performance-unnecessary-value-param should.

Reviewers: aaron.ballman, flx, alexfh

Subscribers: JDevlieghere, cfe-commits

Differential Revision: https://reviews.llvm.org/D28022

llvm-svn: 290883
2017-01-03 12:10:44 +00:00
Haojian Wu 3626516b14 [clang-move] Only move used helper declarations.
Summary:
Instead of moving all the helper declarations blindly, this patch
implements an AST-based call graph solution to make clang-move only move used
helper decls to new.cc and remove unused decls in old.cc.

Depends on D27674.

Reviewers: ioeric

Subscribers: mgorny, cfe-commits

Differential Revision: https://reviews.llvm.org/D27673

llvm-svn: 290873
2017-01-03 09:00:51 +00:00
James Dennett e772e06686 Extend documentation of how to test clang-tidy checks.
Summary:
The documentation assumed expertise with FileCheck; many clang-tidy check
authors may not have significant exposure to FileCheck, and so it's worth
spending a few more words here to spell things out.

Reviewers: alexfh

Subscribers: cfe-commits, JDevlieghere

Differential Revision: https://reviews.llvm.org/D28189

llvm-svn: 290838
2017-01-02 21:45:34 +00:00
Gabor Horvath 7510d9aa8a [clang-tidy] Add delete null pointer check.
This check detects and fixes redundant null checks before deletes.

Patch by: Gergely Angeli!

Differential Revision: https://reviews.llvm.org/D21298

llvm-svn: 290784
2016-12-31 12:45:59 +00:00
Alexander Kornienko 2042f833fd [clang-tidy] google-explicit-constructor: ignore macros
llvm-svn: 290756
2016-12-30 15:15:14 +00:00
Alexander Kornienko 56d0806644 [clang-tidy] google-explicit-constructor: ignore template instantiations
llvm-svn: 290753
2016-12-30 13:25:03 +00:00
Mads Ravn 72bcc049f2 [clang-tidy] Add check 'misc-string-compare'.
I have a created a new check for clang tidy: misc-string-compare. This will check for incorrect usage of std::string::compare when used to check equality or inequality of string instead of the string equality or inequality operators.

Example:
```
  std::string str1, str2;
  if (str1.compare(str2)) {
  }
```

Reviewers: hokein, aaron.ballman, alexfh, malcolm.parsons

Subscribers: xazax.hun, Eugene.Zelenko, cfe-commits, malcolm.parsons, Prazek, mgorny, JDevlieghere

Differential Revision: https://reviews.llvm.org/D27210

llvm-svn: 290747
2016-12-30 10:09:46 +00:00