summaryrefslogtreecommitdiffstats
path: root/clang/lib/Tooling
Commit message (Collapse)AuthorAgeFilesLines
...
* [Tooling] Add an overload of runToolOnCodeWithArgs that takes VFSEric Liu2018-05-181-10/+21
| | | | | | | | | | | | Summary: ... to support purely VFS-based tools. Reviewers: bkramer Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D47074 llvm-svn: 332731
* Move #include manipulation code to new lib/Tooling/Inclusions.Eric Liu2018-05-185-5/+15
| | | | | | | | | | | | | | | Summary: clangToolingCore is linked into almost everything (incl. clang), but not few tools need #include manipulation at this point. So pull this into a separate library in Tooling. Reviewers: ilya-biryukov Subscribers: klimek, mgorny, cfe-commits, thakis Differential Revision: https://reviews.llvm.org/D47068 llvm-svn: 332720
* [clang] Update uses of DEBUG macro to LLVM_DEBUG.Nicola Zaghen2018-05-151-1/+1
| | | | | | | | | | | | | The DEBUG() macro is very generic so it might clash with other projects. The renaming was done as follows: - git grep -l 'DEBUG' | xargs sed -i 's/\bDEBUG\s\?(/LLVM_DEBUG(/g' - git diff -U0 master | ../clang/tools/clang-format/clang-format-diff.py -i -p1 -style LLVM Explicitly avoided changing the strings in the clang-format tests. Differential Revision: https://reviews.llvm.org/D44975 llvm-svn: 332350
* [Tooling] Pull #include manipulation code from clangFormat into libToolingCore.Eric Liu2018-05-142-1/+332
| | | | | | | | | | | | | | Summary: Also pull #include related style out of FormatStyle as tooling::IncludeStyle. Reviewers: ilya-biryukov Reviewed By: ilya-biryukov Subscribers: klimek, mgorny, cfe-commits, djasper Differential Revision: https://reviews.llvm.org/D46496 llvm-svn: 332287
* [clang-format] Move #include related style to libToolingCoreEric Liu2018-05-142-0/+33
| | | | | | | | | | | | | | Summary: This will be shared by include insertion/deletion library. Reviewers: ilya-biryukov Reviewed By: ilya-biryukov Subscribers: mgorny, klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D46758 llvm-svn: 332284
* Remove \brief commands from doxygen comments.Adrian Prantl2018-05-0910-22/+22
| | | | | | | | | | | | | | | | | | | This is similar to the LLVM change https://reviews.llvm.org/D46290. We've been running doxygen with the autobrief option for a couple of years now. This makes the \brief markers into our comments redundant. Since they are a visual distraction and we don't want to encourage more \brief markers in new code either, this patch removes them all. Patch produced by for i in $(git grep -l '\@brief'); do perl -pi -e 's/\@brief //g' $i & done for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done Differential Revision: https://reviews.llvm.org/D46320 llvm-svn: 331834
* IWYU for llvm-config.h in clang. See r331124 for details.Nico Weber2018-04-301-1/+0
| | | | llvm-svn: 331177
* [Tooling] Correct the "-std" compile command option.Haojian Wu2018-04-111-2/+2
| | | | | | | | | | | | | | | Summary: "-std c++11" is not valid in compiler, we have to use "-std=c++11". Test in vscode with this patch, code completion for header works as expected. Reviewers: sammccall Subscribers: cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D45512 llvm-svn: 329786
* [Tooling] Optimize memory usage in InMemoryToolResults.Haojian Wu2018-04-112-3/+13
| | | | | | | | | | | | | | Avoid storing duplicated "std::string"s. clangd's global-symbol-builder takes 20+GB memory running across LLVM repository. With this patch, the used memory is ~10GB (running on 48 threads, most of meory are AST-related). Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D45479 llvm-svn: 329784
* [Tooling] fix UB when interpolating compile commands with an empty indexSam McCall2018-04-101-2/+2
| | | | llvm-svn: 329685
* [Tooling] A CompilationDatabase wrapper that infers header commands.Sam McCall2018-04-092-0/+459
| | | | | | | | | | | | Summary: The wrapper finds the closest matching compile command using filename heuristics and makes minimal tweaks so it can be used with the header. Subscribers: klimek, mgorny, cfe-commits Differential Revision: https://reviews.llvm.org/D45006 llvm-svn: 329580
* Fix typos in clangAlexander Kornienko2018-04-064-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Found via codespell -q 3 -I ../clang-whitelist.txt Where whitelist consists of: archtype cas classs checkk compres definit frome iff inteval ith lod methode nd optin ot pres statics te thru Patch by luzpaz! (This is a subset of D44188 that applies cleanly with a few files that have dubious fixes reverted.) Differential revision: https://reviews.llvm.org/D44188 llvm-svn: 329399
* [clang] Change std::sort to llvm::sort in response to r327219Mandeep Singh Grang2018-03-272-6/+6
| | | | | | | | | | | r327219 added wrappers to std::sort which randomly shuffle the container before sorting. This will help in uncovering non-determinism caused due to undefined sorting order of objects having the same key. To make use of that infrastructure we need to invoke llvm::sort instead of std::sort. llvm-svn: 328636
* Move a ref-counted pointer instead of copying it. NFC.Alexander Kornienko2018-03-271-1/+1
| | | | llvm-svn: 328623
* [Tooling] Fix some Clang-tidy modernize and Include What You Use warnings; ↵Eugene Zelenko2018-03-146-135/+235
| | | | | | other minor fixes (NFC). llvm-svn: 327573
* Revert "[Tooling] [0/1] Refactor FrontendActionFactory::create() to return ↵Roman Lebedev2018-02-271-20/+17
| | | | | | | | | | | | std::unique_ptr<>" This reverts commit rL326201 This broke gcc4.8 builds, compiler just segfaults:¬ http://lab.llvm.org:8011/builders/clang-atom-d525-fedora-rel/builds/14909¬ http://lab.llvm.org:8011/builders/clang-x86_64-linux-abi-test/builds/22673¬ llvm-svn: 326204
* [Tooling] [0/1] Refactor FrontendActionFactory::create() to return ↵Roman Lebedev2018-02-271-17/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | std::unique_ptr<> Summary: Noticed during review of D41102. I'm not sure whether there are any principal reasons why it returns raw owning pointer, or it is just a old code that was not updated post-C++11. I'm not too sure what testing i should do, because `check-all` is not error clean here for some reason, but it does not //appear// asif those failures are related to these changes. This is clang part. Clang-tools-extra part is D43780. Reviewers: klimek, bkramer, alexfh, pcc Reviewed By: alexfh Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D43779 llvm-svn: 326201
* [Tooling] Returns non-zero status code when files are skipped.Eric Liu2018-02-021-6/+3
| | | | | | | | | | | | Reviewers: hokein, bkramer Reviewed By: bkramer Subscribers: bkramer, klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D42361 llvm-svn: 324113
* [Tooling] Added a VFS parameter to ClangToolIlya Biryukov2018-01-231-2/+3
| | | | | | | | | | | | | | | | | | Summary: The parameter overrides the underlying vfs used by ClangTool for filesystem operations. Patch by Vladimir Plyashkun. Reviewers: alexfh, ilya-biryukov Reviewed By: ilya-biryukov Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D41947 llvm-svn: 323195
* [Tooling] Don't deduplicate tool results in the All-TUs executor.Eric Liu2018-01-171-11/+6
| | | | | | | | | | | | | | Summary: As result deduplication or reduction is not supported in the framework, we should leave the deplication to tools (if needed) until the framework supports it. Reviewers: bkramer Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D42111 llvm-svn: 322691
* Add a tool executor that runs actions on all TUs in the compilation database.Eric Liu2018-01-053-1/+170
| | | | | | | | | | | | Summary: Tool results are deduplicated by the result key. Reviewers: hokein Subscribers: klimek, mgorny, cfe-commits Differential Revision: https://reviews.llvm.org/D41729 llvm-svn: 321864
* [Tooling] Acknowledge that many CompilationDatabases don't support enumeration.Sam McCall2017-11-241-10/+9
| | | | | | | | | | | | Summary: Provide default implementations so that only getCompileCommands() is mandatory. Reviewers: ioeric Subscribers: cfe-commits, bkramer, klimek Differential Revision: https://reviews.llvm.org/D40409 llvm-svn: 318943
* Fix skipping of flags in getClangStripDependencyFileAdjusterDave Lee2017-11-171-5/+5
| | | | | | | | | | | | | | | | | | Summary: The ArgumentsAdjuster returned from `getClangStripDependencyFileAdjuster` will skip dependency flags, and also their associated values for those flags that take an argument. This change corrects the handling of the `-MD` and `-MMD` flags, which do not take an argument. Reviewers: saugustine, klimek, alexshap Reviewed By: alexshap Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D40024 llvm-svn: 318529
* [refactor][selection] canonicalize decl ref callee to the call exprAlex Lorenz2017-11-141-13/+48
| | | | | | | We would like to extract the full call when just the callee function is selected llvm-svn: 318215
* [refactor][selection] canonicalize member expr callee to the fullAlex Lorenz2017-11-141-1/+12
| | | | | | | | member call expression We would like to extract the full call when just the callee is selected. llvm-svn: 318205
* [refactor][extract] avoid extracting expressions from types in functionsAlex Lorenz2017-11-141-2/+4
| | | | llvm-svn: 318169
* [Tooling] Use FixedCompilationDatabase when `compile_flags.txt` is found.Sam McCall2017-11-091-2/+36
| | | | | | | | | | | | | | | | | | | | | Summary: This is an alternative to JSONCompilationDatabase for simple projects that don't use a build system such as CMake. (You can also drop one in ~, to make your tools use e.g. C++11 by default) There's no facility for varying flags per-source-file or per-machine. Possibly this could be accommodated backwards-compatibly using cpp, but even if not the simplicity seems worthwhile for the cases that are addressed. Tested with clangd, works great! (requires clangd restart) Reviewers: klimek Subscribers: ilya-biryukov, cfe-commits Differential Revision: https://reviews.llvm.org/D39799 llvm-svn: 317777
* [clang-refactor] Get rid of OccurrencesFinder in RenamingAction, NFCHaojian Wu2017-11-081-18/+9
| | | | | | | | | | | | | | | | | | Summary: The OccurrencesFinder is only used in RenameOccurrences to find symbol occurrences, there is no need to inherit RefactoringRule. Replace it with a single utility function to avoid code misleading. Reviewers: sammccall Reviewed By: sammccall Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D39796 llvm-svn: 317696
* Moved QualTypeNames.h from Tooling to AST.Ilya Biryukov2017-11-082-478/+0
| | | | | | | | | | | | | | | | | Summary: For code reuse in SemaCodeComplete. Note that the tests for QualTypeNames are still in Tooling as they use Tooling's common testing code. Reviewers: rsmith, saugustine, rnk, klimek, bkramer Reviewed By: rnk Subscribers: cfe-commits, mgorny Differential Revision: https://reviews.llvm.org/D39224 llvm-svn: 317676
* [clang-refactor] Introduce a new rename rule for qualified symbolsHaojian Wu2017-11-082-0/+76
| | | | | | | | | | | | | | Summary: Prototype of a new rename rule for renaming qualified symbol. Reviewers: arphaman, ioeric, sammccall Reviewed By: arphaman, sammccall Subscribers: jklaehn, cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D39332 llvm-svn: 317672
* Move Extract.cpp that wasn't moved in r317343Alex Lorenz2017-11-031-0/+0
| | | | llvm-svn: 317344
* [refactor][extract] insert semicolons into extracted/inserted codeAlex Lorenz2017-11-034-4/+173
| | | | | | | | | | | | | | | | | | when needed This commit implements the semicolon insertion logic into the extract refactoring. The following rules are used: - extracting expression: add terminating ';' to the extracted function. - extracting statements that don't require terminating ';' (e.g. switch): add terminating ';' to the callee. - extracting statements with ';': move (if possible) the original ';' from the callee and add terminating ';'. - otherwise, add ';' to both places. Differential Revision: https://reviews.llvm.org/D39441 llvm-svn: 317343
* [Tooling] Fix linking of StandaloneToolExecutorPlugin.Eric Liu2017-11-032-5/+11
| | | | llvm-svn: 317332
* [Tooling] Put createExecutorFromCommandLineArgs implementation in a wrapper. NFCEric Liu2017-11-031-3/+13
| | | | llvm-svn: 317328
* [refactor][selection] canonicalize selected string literal to objcAlex Lorenz2017-11-021-1/+22
| | | | | | string literal when possible llvm-svn: 317224
* [refactor][extract] code extracted from inline method should be placedAlex Lorenz2017-11-011-2/+7
| | | | | | in a function defined before the outer class llvm-svn: 317062
* [refactor][extract] prohibit extraction of ObjC property settersAlex Lorenz2017-11-011-5/+14
| | | | llvm-svn: 317056
* [refactor][selection] code ranges can be selected in objc methodsAlex Lorenz2017-11-011-4/+7
| | | | llvm-svn: 317054
* [refactor] select the entire DeclStmt if one ifs decls is selectedAlex Lorenz2017-10-311-5/+17
| | | | llvm-svn: 316971
* [refactor] Fix a clang-tidy warning.Haojian Wu2017-10-301-1/+2
| | | | | | NFC llvm-svn: 316895
* [refactor] Describe refactorings in the operation classesAlex Lorenz2017-10-273-146/+126
| | | | | | | | | | | | | | | | | This commit changes the way that the refactoring operation classes are structured: - Users have to call `initiate` instead of constructing an instance of the class. The `initiate` is now supposed to have custom initiation logic, and you don't need to subclass the builtin requirements. - A new `describe` function returns a structure with the id, title and the description of the refactoring operation. The refactoring action classes are now placed into one common place in RefactoringActions.cpp instead of being separate. Differential Revision: https://reviews.llvm.org/D38985 llvm-svn: 316780
* Try to fix warnings and windows test failures caused by r316653Eric Liu2017-10-261-1/+1
| | | | llvm-svn: 316661
* [Tooling] A new framework for executing clang frontend actions.Eric Liu2017-10-266-8/+193
| | | | | | | | | | | | | | | | | | | | | | | Summary: This defines a `clang::tooling::ToolExecutor` interface that can be extended to support different execution plans including standalone execution on a given set of TUs or parallel execution on all TUs in a codebase. In order to enable multiprocessing execution, tool actions are expected to output result into a `ToolResults` interface provided by executors. The `ToolResults` interface abstracts how results are stored e.g. in-memory for standalone executions or on-disk for large-scale execution. New executors can be registered as `ToolExecutorPlugin`s via the `ToolExecutorPluginRegistry`. CLI tools can use `createExecutorFromCommandLineArgs` to create a specific registered executor according to the command-line arguments. This patch also implements `StandaloneToolExecutor` which has the same behavior as the current `ClangTool` interface, i.e. execute frontend actions on a given set of TUs. At this point, it's simply a wrapper around `ClangTool` at this point. This is still experimental but expected to replace the existing `ClangTool` interface so that specific tools would not need to worry about execution. Reviewers: klimek, arphaman, hokein, sammccall Reviewed By: klimek Subscribers: cfe-commits, djasper, mgorny, omtcyfz Differential Revision: https://reviews.llvm.org/D34272 llvm-svn: 316653
* [rename] support renaming class member.Haojian Wu2017-10-251-0/+49
| | | | | | | | | | | | Reviewers: ioeric Reviewed By: ioeric Subscribers: klimek, cfe-commits, mgorny Differential Revision: https://reviews.llvm.org/D39178 llvm-svn: 316571
* [clang-rename] Fix and enable the failing TemplatedClassFunction test.Haojian Wu2017-10-251-0/+20
| | | | | | | | | | | | Reviewers: ioeric Reviewed By: ioeric Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D39241 llvm-svn: 316561
* Add missing clangRewrite lib dependency for clangToolingRefactorAlex Lorenz2017-10-241-0/+1
| | | | llvm-svn: 316467
* [refactor] Initial outline of implementation of "extract function" refactoringAlex Lorenz2017-10-244-0/+319
| | | | | | | | | | | | | | | | | | | This commit adds an initial, skeleton outline of the "extract function" refactoring. The extracted function doesn't capture variables / rewrite code yet, it just basically does a simple copy-paste. The following initiation rules are specified: - extraction can only be done for executable code in a function/method/block. This means that you can't extract a global variable initialize into a function right now. - simple literals and references are not extractable. This commit also adds support for full source ranges to clang-refactor's test mode. Differential Revision: https://reviews.llvm.org/D38982 llvm-svn: 316465
* [Tooling] Add a factory method for CommonOptionsParserEric Liu2017-10-241-6/+39
| | | | | | | | | | | | | | Summary: This returns error instead of exiting the program in case of error. Reviewers: klimek, hokein Reviewed By: hokein Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D39042 llvm-svn: 316433
* [rename] Don't overwrite the template argument when renaming a template ↵Haojian Wu2017-10-231-1/+6
| | | | | | | | | | | | | | function. Reviewers: ioeric Reviewed By: ioeric Subscribers: cierpuchaw, cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D39120 llvm-svn: 316314
* Revert r316193.Richard Smith2017-10-201-3/+1
| | | | | | | This patch breaks users using -fno-canonical-prefixes, for whom resolving symlinks is not acceptable. llvm-svn: 316195
OpenPOWER on IntegriCloud