Commit Graph

1609 Commits

Author SHA1 Message Date
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
Haojian Wu 17baf85e41 [clang-tidy] Add more descriptive comments and examples in misc-definitions-in-headers check.
Reviewers: alexfh

Subscribers: cfe-commits

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

llvm-svn: 270197
2016-05-20 09:38:25 +00:00
Eric Liu 81554e7257 [find-all-symbols] fixed FindAllMacros compilation error.
llvm-svn: 270196
2016-05-20 09:23:19 +00:00
Eric Liu 83a4d7fbba [find-all-symbols] make HeaderMapCollector optional in FindAllSymbols and FindAllMacros.
llvm-svn: 270193
2016-05-20 09:12:01 +00:00
Haojian Wu 1cea6e5531 [clang-tidy] Handle using-decls with more than one shadow decl.
Reviewers: alexfh

Subscribers: cfe-commits, djasper

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

llvm-svn: 270191
2016-05-20 08:34:32 +00:00
Haojian Wu 5e4f0255a1 [find-all-symbol] Add macro support.
Reviewers: bkramer

Subscribers: cfe-commits, ioeric

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

llvm-svn: 270189
2016-05-20 08:04:36 +00:00
Benjamin Kramer ee4e522c26 [include-fixer] Fix unused variable warning in Release builds.
llvm-svn: 270082
2016-05-19 16:57:57 +00:00
Haojian Wu 0de7226236 [include-fixer] Remove an unused local variable ExistingHeaders.
llvm-svn: 270059
2016-05-19 13:23:27 +00:00
Benjamin Kramer 9b15b6f2d7 [include-fixer] Make search handle fully qualified names correctly.
If a search string starts with "::" we don't want to return any results
for suffixes of that string.

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

llvm-svn: 270055
2016-05-19 12:41:56 +00:00
Benjamin Kramer 04666a2d5d [include-fixer] Remove obsolete windows hack.
llvm-svn: 270045
2016-05-19 11:39:56 +00:00
Alexander Kornienko a20bab46cd [clang-tidy] Fix/add style guide links.
Thanks to Tim Halloran for the initial patch (http://reviews.llvm.org/D15089)!

llvm-svn: 270033
2016-05-19 09:31:30 +00:00
Alexander Kornienko 77c8b2ed9f [clang-tidy] Fix doc titles.
llvm-svn: 270032
2016-05-19 09:29:46 +00:00
Eric Liu 702cfd1b2b [include-fixer] Sort headers after inserting new headers.
Summary: [include-fixer] Sort headers after inserting new headers.

Reviewers: bkramer

Subscribers: klimek, djasper, hokein, cfe-commits

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

llvm-svn: 270031
2016-05-19 08:21:09 +00:00
Benjamin Kramer 5e6b35f4d1 [include-fixer] Also look up prefixes of queries.
This is used to find nested classes. For a nested name foo::bar::qux we
will first look up foo::bar::qux, then foo::bar, then foo unless we find
a result. This is used to support nested classes which are not part of
the index but can only be used if the header for the parent context is
included.

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

llvm-svn: 269956
2016-05-18 16:42:38 +00:00
Miklos Vajna 5a6d2985d7 clang-rename: handle non-inline ctor definitions when renaming classes
The result of the test was C::D(), not D::D().

Reviewers: cfe-commits, klimek

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

llvm-svn: 269952
2016-05-18 16:12:48 +00:00
Haojian Wu 1bc05a681e [clang-tidy] Use unresolvedLookupExpr node matcher from ASTMatcher.
Reviewers: alexfh, aaron.ballman

Subscribers: aaron.ballman, cfe-commits

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

llvm-svn: 269928
2016-05-18 14:11:20 +00:00
Eric Liu c7f3b108e2 [clang-include-fixer] Added Vim integration for clang-include-fixer.
Summary: [clang-include-fixer] Added Vim integration for clang-include-fixer.

Reviewers: hokein, bkramer

Subscribers: cfe-commits

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

llvm-svn: 269927
2016-05-18 14:10:16 +00:00
Benjamin Kramer 6b5160a369 [include-fixer] Don't insert #includes if a fatal error occurred.
This typically happens when the user didn't setup include paths correctly
and the fixer starts adding garbage includes. Avoid that. Disable the error
limit though, as we might hit that easily with missing includes and still
want to fix those cases.

llvm-svn: 269923
2016-05-18 13:32:38 +00:00
Haojian Wu 4405d5b2cc [clang-tidy] Fix misc-unused-using-decls test failure in windows
buildbot.

llvm-svn: 269918
2016-05-18 13:07:13 +00:00
Haojian Wu 47ea5424d2 [clang-tidy] Fix a template function false positive in misc-unused-using-decls check.
Summary: Ignore warning uninstantiated template function usages.

Reviewers: djasper, alexfh

Subscribers: cfe-commits

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

llvm-svn: 269906
2016-05-18 11:49:34 +00:00
Benjamin Kramer 8b55a2b76c [clang-tidy] Fix a functional change from r269656.
Instead of forming char ranges that patch made us form token ranges,
which behave subtly different. Sadly I'm only seeing this as part of a
larger test case that I haven't fully reduced yet.

llvm-svn: 269896
2016-05-18 09:48:46 +00:00
Benjamin Kramer 2ecd0902c7 [include-fixer] Run tests with -fno-ms-compatibility.
Something behind that flag makes us get fewer typo correction callbacks,
unbreak the tests on windows for now.

llvm-svn: 269894
2016-05-18 09:28:45 +00:00
Haojian Wu ff6d195c2d [include-fixer] Ignore non-scoped enum declaration during search.
Reviewers: bkramer

Subscribers: cfe-commits, ioeric

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

llvm-svn: 269890
2016-05-18 09:04:43 +00:00
NAKAMURA Takumi e1f0ed0a1f findAllSymbols: Prune unused libdeps.
llvm-svn: 269875
2016-05-18 00:53:31 +00:00
NAKAMURA Takumi ea46e8b674 FindAllSymbolsTests doesn't require clangToolingCore.
llvm-svn: 269874
2016-05-18 00:53:27 +00:00
NAKAMURA Takumi 37c64ee4ec include-fixer: They require clangLex.
llvm-svn: 269873
2016-05-18 00:49:16 +00:00
NAKAMURA Takumi 62e8ec5721 IncludeFixerTest.cpp: Add explicit triple for some tests. They are failing for targeting *-win32.
llvm-svn: 269870
2016-05-18 00:20:46 +00:00
Etienne Bergeron e15ef2f609 [clang-tidy] Lift common matchers to utils namespace
Summary:
This patch is lifting matchers used by more than one checkers
to the common namespace.

Reviewers: aaron.ballman, alexfh

Subscribers: aaron.ballman, cfe-commits

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

llvm-svn: 269804
2016-05-17 19:36:09 +00:00
Miklos Vajna a7445f1b5e clang-rename: avoid StringRef members in USRLocFindingASTVisitor
Even if this is defined in the .cpp file and only used as part of the
function (so here it's safe), usually storing StringRefs in the class is
dangerous, so don't do so.

Reviewers: cfe-commits, klimek

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

llvm-svn: 269796
2016-05-17 18:17:16 +00:00
Vedant Kumar 5119923cdd [clang-tidy] Skip misc-macro-parentheses for namespaces (Fix PR27400)
If a use of a macro argument is preceded by the `namespace` keyword, do
not warn that the use should be wrapped in parentheses.

Patch by Mads Ravn!

llvm-svn: 269786
2016-05-17 17:26:02 +00:00
Haojian Wu 2a6d78b820 [find-all-symbols] Add IWYU private pragma support.
Reviewers: djasper, klimek

Subscribers: kimgr, cfe-commits, bkramer, ioeric

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

llvm-svn: 269779
2016-05-17 16:48:49 +00:00
Haojian Wu 39170d70c0 [find-all-symbols] Ignore anonymous enum declarations.
llvm-svn: 269762
2016-05-17 13:38:18 +00:00
Benjamin Kramer af34e06c69 [include-fixer] Make the "extend to the right" hack support typos without nested names in the front.
This handles cases where the initial namespace is unknown.

llvm-svn: 269758
2016-05-17 12:35:18 +00:00
Etienne Bergeron 8d73de9eac [clang-tidy] Cleanups utils files
Summary:
Cleanup some code by using appropriate APIs.
Some coding style cleanups.

There is no behavior changes.

 - Function `IncludeSorter::CreateFixIt` can be replaced by `FixItHint::CreateReplacement`.
 - Function `cleanPath` is a wrapper for `llvm::sys::path::remove_dots`.

Reviewers: alexfh

Subscribers: cfe-commits

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

llvm-svn: 269656
2016-05-16 14:34:20 +00:00
Felix Berger 9435f54167 [clang-tidy] TypeTraits - Type is not expensive to copy when it has a deleted copy constructor.
Reviewers: alexfh, sbenza

Subscribers: etienneb, aaron.ballman, cfe-commits

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

llvm-svn: 269581
2016-05-14 22:43:50 +00:00
Eugene Zelenko 804e58d62e [Release notes] Mention Clang-tidy modernize-avoid-bind check.
Fix some problems in its documentation.

llvm-svn: 269517
2016-05-13 23:35:56 +00:00
Etienne Bergeron 8db5174395 [include-fixer] Fix broken dependency shared build
Summary:
The shared build is broken (again).

To repro: [Release + Shared]
```
-DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON
```

Errors:
```
tools/clang/tools/extra/include-fixer/tool/CMakeFiles/clang-include-fixer.dir/ClangIncludeFixer.cpp.o: In function `(anonymous namespace)::includeFixerMain(int, char const**)':
ClangIncludeFixer.cpp:(.text._ZN12_GLOBAL__N_116includeFixerMainEiPPKc+0xbe9): undefined reference to `clang::find_all_symbols::SymbolInfo::SymbolInfo(llvm::StringRef, clang::find_all_symbols::SymbolInfo::SymbolKind, llvm::StringRef, int, std::vector<std::pair<clang::find_all_symbols::SymbolInfo::ContextType, std::string>, std::allocator<std::pair<clang::find_all_symbols::SymbolInfo::ContextType, std::string> > > const&)'
collect2: error: ld returned 1 exit status
```

```
tools/clang/tools/extra/unittests/include-fixer/CMakeFiles/IncludeFixerTests.dir/IncludeFixerTest.cpp.o: In function `clang::include_fixer::(anonymous namespace)::runIncludeFixer(llvm::StringRef, std::vector<std::string, std::allocator<std::string> > const&)':
IncludeFixerTest.cpp:(.text._ZN5clang13include_fixer12_GLOBAL__N_1L15runIncludeFixerEN4llvm9StringRefERKSt6vectorISsSaISsEE+0x10e): undefined reference to `clang::find_all_symbols::SymbolInfo::SymbolInfo(llvm::StringRef, clang::find_all_symbols::SymbolInfo::SymbolKind, llvm::StringRef, int, std::vector<std::pair<clang::find_all_symbols::SymbolInfo::ContextType, std::string>, std::allocator<std::pair<clang::find_all_symbols::SymbolInfo::ContextType, std::string> > > const&)'
IncludeFixerTest.cpp:(.text._ZN5clang13include_fixer12_GLOBAL__N_1L15runIncludeFixerEN4llvm9StringRefERKSt6vectorISsSaISsEE+0x1dc): undefined reference to `clang::find_all_symbols::SymbolInfo::SymbolInfo(llvm::StringRef, clang::find_all_symbols::SymbolInfo::SymbolKind, llvm::StringRef, int, std::vector<std::pair<clang::find_all_symbols::SymbolInfo::ContextType, std::string>, std::allocator<std::pair<clang::find_all_symbols::SymbolInfo::ContextType, std::string> > > const&)'
IncludeFixerTest.cpp:(.text._ZN5clang13include_fixer12_GLOBAL__N_1L15runIncludeFixerEN4llvm9StringRefERKSt6vectorISsSaISsEE+0x2f3): undefined reference to `clang::find_all_symbols::SymbolInfo::SymbolInfo(llvm::StringRef, clang::find_all_symbols::SymbolInfo::SymbolKind, llvm::StringRef, int, std::vector<std::pair<clang::find_all_symbols::SymbolInfo::ContextType, std::string>, std::allocator<std::pair<clang::find_all_symbols::SymbolInfo::ContextType, std::string> > > const&)'
IncludeFixerTest.cpp:(.text._ZN5clang13include_fixer12_GLOBAL__N_1L15runIncludeFixerEN4llvm9StringRefERKSt6vectorISsSaISsEE+0x40e): undefined reference to `clang::find_all_symbols::SymbolInfo::SymbolInfo(llvm::StringRef, clang::find_all_symbols::SymbolInfo::SymbolKind, llvm::StringRef, int, std::vector<std::pair<clang::find_all_symbols::SymbolInfo::ContextType, std::string>, std::allocator<std::pair<clang::find_all_symbols::SymbolInfo::ContextType, std::string> > > const&)'
IncludeFixerTest.cpp:(.text._ZN5clang13include_fixer12_GLOBAL__N_1L15runIncludeFixerEN4llvm9StringRefERKSt6vectorISsSaISsEE+0x526): undefined reference to `clang::find_all_symbols::SymbolInfo::SymbolInfo(llvm::StringRef, clang::find_all_symbols::SymbolInfo::SymbolKind, llvm::StringRef, int, std::vector<std::pair<clang::find_all_symbols::SymbolInfo::ContextType, std::string>, std::allocator<std::pair<clang::find_all_symbols::SymbolInfo::ContextType, std::string> > > const&)'
```

Reviewers: bkramer, hokein

Subscribers: cfe-commits

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

llvm-svn: 269441
2016-05-13 17:38:22 +00:00
Haojian Wu 57cdcb07d6 [include-fixer] Use scope contexts information to improve query.
Reviewers: bkramer

Subscribers: cfe-commits

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

llvm-svn: 269430
2016-05-13 15:44:16 +00:00
Etienne Bergeron a4bc53afba [clang-rename] Fix broken dependency on shared build.
Summary:
The build is broken due to a missing dependency.

To repro: [Release + Shared]
```
-DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON
```

Which produce this error:
```
tools/clang/tools/extra/clang-rename/CMakeFiles/clangRename.dir/USRLocFinder.cpp.o: In function `clang::RecursiveASTVisitor<clang::rename::(anonymous namespace)::USRLocFindingASTVisitor>::TraverseCXXConstructorDecl(clang::CXXConstructorDecl*)':
USRLocFinder.cpp:(.text._ZN5clang19RecursiveASTVisitorINS_6rename12_GLOBAL__N_123USRLocFindingASTVisitorEE26TraverseCXXConstructorDeclEPNS_18CXXConstructorDeclE+0x170): undefined reference to `clang::Lexer::getSourceText(clang::CharSourceRange, clang::SourceManager const&, clang::LangOptions const&, bool*)'
```

Reviewers: alexfh, yaron.keren

Subscribers: yaron.keren, cfe-commits

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

llvm-svn: 269429
2016-05-13 15:38:54 +00:00
Haojian Wu 631e5f23f9 [include-fixer] Simplify unittest code.
Summary:
The InMemorySymbolIndex only constructs hard-coded Class symbols from a string
map. The patch provide a flexable way in InMemorySymbolIndex to create a custom
SymbolInfo in the include-fixer unittest.

Reviewers: bkramer

Subscribers: cfe-commits

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

llvm-svn: 269427
2016-05-13 15:17:17 +00:00
Haojian Wu db98f1d9c9 [find-all-symbols] Add EnumDecl type in YAML traits.
llvm-svn: 269422
2016-05-13 14:53:10 +00:00