summaryrefslogtreecommitdiffstats
path: root/clang/lib/Tooling
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix memory leak by storing returned pointer in std::unique_ptrRichard Trieu2016-08-301-4/+3
| | | | llvm-svn: 280157
* Fix colored diagnostics from toolsOlivier Goffart2016-08-301-0/+8
| | | | | | | | | | r271042 changed the way the diagnostic arguments are parsed. It assumes that the diagnostics options were already parsed by the "Driver". For tools using clang::Tooling, the diagnostics argument were not parsed. Differential Revision: https://reviews.llvm.org/D23837 llvm-svn: 280118
* Fix json compilation database syntax on non-Windows.Zachary Turner2016-08-181-4/+2
| | | | llvm-svn: 279122
* Resubmit "[Tooling] Parse compilation database command lines on Windows."Zachary Turner2016-08-181-12/+42
| | | | | | | | | | | | | | | | | | This patch introduced the ability to decide at runtime whether to parse JSON compilation database command lines using Gnu syntax or Windows syntax. However, there were many existing unit tests written that hardcoded Gnu-specific paths. These tests were now failing because the auto-detection logic was choosing to parse them using Windows rules. This resubmission of the patch fixes this by introducing an enum which defines the syntax mode, which defaults to auto-detect, but for which the unit tests force Gnu style parsing. Reviewed By: alexfh Differential Revision: https://reviews.llvm.org/D23628 llvm-svn: 279120
* Revert "[Tooling] Parse compilation database command lines on Windows."Zachary Turner2016-08-171-18/+0
| | | | | | | | | | This reverts commit 27a874790fc79f6391ad3703d7c790f51ac6ae1f. After the introduction of windows command line parsing, some unit tests began failing that expect to test gnu style command line quirks. The fix is mechanical but time consuming, so revert this for now. llvm-svn: 278976
* [Tooling] Parse compilation database command lines on Windows.Zachary Turner2016-08-171-0/+18
| | | | | | | | | | | | | When a compilation database is used on Windows, the command lines cannot be parsed using the standard GNU style syntax. LLVM provides functions for parsing Windows style command lines, so use them where appropriate. After this patch, clang-tidy runs correctly on Windows. Reviewed by: alexfh Differential Revision: https://reviews.llvm.org/D23455 llvm-svn: 278964
* Fixes calculateRangesAfterReplacements crash when Replacements is empty.Eric Liu2016-08-081-0/+2
| | | | | | | | | | Reviewers: klimek, djasper Subscribers: cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D23264 llvm-svn: 278004
* Reapply r276973 "Adjust Registry interface to not require plugins to export ↵John Brawn2016-08-051-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | a registry" This differs from the previous version by being more careful about template instantiation/specialization in order to prevent errors when building with clang -Werror. Specifically: * begin is not defined in the template and is instead instantiated when Head is. I think the warning when we don't do that is wrong (PR28815) but for now at least do it this way to avoid the warning. * Instead of performing template specializations in LLVM_INSTANTIATE_REGISTRY instead provide a template definition then do explicit instantiation. No compiler I've tried has problems with doing it the other way, but strictly speaking it's not permitted by the C++ standard so better safe than sorry. Original commit message: Currently the Registry class contains the vestiges of a previous attempt to allow plugins to be used on Windows without using BUILD_SHARED_LIBS, where a plugin would have its own copy of a registry and export it to be imported by the tool that's loading the plugin. This only works if the plugin is entirely self-contained with the only interface between the plugin and tool being the registry, and in particular this conflicts with how IR pass plugins work. This patch changes things so that instead the add_node function of the registry is exported by the tool and then imported by the plugin, which solves this problem and also means that instead of every plugin having to export every registry they use instead LLVM only has to export the add_node functions. This allows plugins that use a registry to work on Windows if LLVM_EXPORT_SYMBOLS_FOR_PLUGINS is used. llvm-svn: 277806
* Fix bug in conflict check for Replacements::add().Manuel Klimek2016-08-031-7/+8
| | | | | | | We would not detect conflicts when inserting insertions at the same offset as previously contained replacements. llvm-svn: 277603
* Fix quadratic runtime when adding items to tooling::Replacements.Manuel Klimek2016-08-031-18/+48
| | | | | | | | | | | Previously, we would search through all replacements when inserting a new one to check for overlaps. Instead, make use of the fact that we already have a set of replacments without overlaps to find the potential overlap with lower_bound. Differential Revision: https://reviews.llvm.org/D23119 llvm-svn: 277597
* Implement tooling::Replacements as a class.Eric Liu2016-08-013-217/+199
| | | | | | | | | | | | | | | | | | | Summary: - Implement clang::tooling::Replacements as a class to provide interfaces to control how replacements for a single file are combined and provide guarantee on the order of replacements being applied. - tooling::Replacements only contains replacements for the same file now. Use std::map<std::string, tooling::Replacements> to represent multi-file replacements. - Error handling for the interface change will be improved in followup patches. Reviewers: djasper, klimek Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D21748 llvm-svn: 277335
* Revert r276973 "Adjust Registry interface to not require plugins to export a ↵John Brawn2016-07-281-2/+0
| | | | | | | | | registry" Buildbot failures when building with clang -Werror. Reverting while I try to figure this out. llvm-svn: 277008
* Reapply r276856 "Adjust Registry interface to not require plugins to export ↵John Brawn2016-07-281-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | a registry" This version has two fixes compared to the original: * In Registry.h the template static members are instantiated before they are used, as clang gives an error if you do it the other way around. * The use of the Registry template in clang-tidy is updated in the same way as has been done everywhere else. Original commit message: Currently the Registry class contains the vestiges of a previous attempt to allow plugins to be used on Windows without using BUILD_SHARED_LIBS, where a plugin would have its own copy of a registry and export it to be imported by the tool that's loading the plugin. This only works if the plugin is entirely self-contained with the only interface between the plugin and tool being the registry, and in particular this conflicts with how IR pass plugins work. This patch changes things so that instead the add_node function of the registry is exported by the tool and then imported by the plugin, which solves this problem and also means that instead of every plugin having to export every registry they use instead LLVM only has to export the add_node functions. This allows plugins that use a registry to work on Windows if LLVM_EXPORT_SYMBOLS_FOR_PLUGINS is used. llvm-svn: 276973
* Revert r276856 "Adjust Registry interface to not require plugins to export a ↵John Brawn2016-07-271-2/+0
| | | | | | | | registry" This is causing a huge pile of buildbot failures. llvm-svn: 276857
* Adjust Registry interface to not require plugins to export a registryJohn Brawn2016-07-271-0/+2
| | | | | | | | | | | | | | | | | | | | Currently the Registry class contains the vestiges of a previous attempt to allow plugins to be used on Windows without using BUILD_SHARED_LIBS, where a plugin would have its own copy of a registry and export it to be imported by the tool that's loading the plugin. This only works if the plugin is entirely self-contained with the only interface between the plugin and tool being the registry, and in particular this conflicts with how IR pass plugins work. This patch changes things so that instead the add_node function of the registry is exported by the tool and then imported by the plugin, which solves this problem and also means that instead of every plugin having to export every registry they use instead LLVM only has to export the add_node functions. This allows plugins that use a registry to work on Windows if LLVM_EXPORT_SYMBOLS_FOR_PLUGINS is used. Differential Revision: http://reviews.llvm.org/D21385 llvm-svn: 276856
* [Tooling] skip anonymous namespaces when checking if typeLoc references a ↵Eric Liu2016-07-261-16/+29
| | | | | | | | | | | | | | | | type decl from a different canonical namespace. Summary: [Tooling] skip anonymous namespaces when checking if typeLoc references a type decl from a different canonical namespace. Reviewers: bkramer Subscribers: cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D22808 llvm-svn: 276754
* [NFC] Header cleanupMehdi Amini2016-07-184-6/+3
| | | | | | | | | | Summary: Removed unused headers, replaced some headers with forward class declarations Patch by: Eugene <claprix@yandex.ru> Differential Revision: https://reviews.llvm.org/D20100 llvm-svn: 275882
* Make tooling::applyAllReplacements return llvm::Expected<string> instead of ↵Eric Liu2016-07-112-5/+13
| | | | | | | | | | | | | | | | empty string to indicate potential error. Summary: return llvm::Expected<> to carry error status and error information. This is the first step towards introducing "Error" into tooling::Replacements. Reviewers: djasper, klimek Subscribers: ioeric, klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D21601 llvm-svn: 275062
* [AST] Use ArrayRef in more interfacesDavid Majnemer2016-07-071-2/+2
| | | | | | | | | ArrayRef is a little better than passing around a pointer/length pair. No functional change is intended. llvm-svn: 274732
* [Tooling] Add optional argument to getFullyQualifiedName to prepend "::".Siva Chandra2016-06-291-47/+94
| | | | | | | | | | Reviewers: rsmith, saugustine, rnk Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D21666 llvm-svn: 274185
* NFC. Test commit, remove a redundant empty line in Tooling.cppArtur Pilipenko2016-06-281-1/+0
| | | | llvm-svn: 274041
* Trying to fix a buffer overflow that broke buildbot ↵Eric Liu2016-06-211-1/+1
| | | | | | sanitizer-x86_64-linux-fast/builds/13946. llvm-svn: 273319
* Added calculateRangesAfterReplaments() to calculate affacted ranges in the ↵Eric Liu2016-06-211-2/+38
| | | | | | | | | | | | | | | | new code. Summary: Added calculateRangesAfterReplaments() to calculate original ranges as well as newly affacted ranges in the new code. Reviewers: klimek, djasper Subscribers: cfe-commits, klimek Differential Revision: http://reviews.llvm.org/D21547 llvm-svn: 273290
* Apply some suggestions from clang-tidy's performance-unnecessary-value-param.Benjamin Kramer2016-06-152-3/+4
| | | | | | No functionality change intended. llvm-svn: 272789
* Add some std::move where the value is only read otherwise.Benjamin Kramer2016-06-121-10/+13
| | | | | | This mostly affects smart pointers. No functionality change intended. llvm-svn: 272520
* Avoid unnecessary std::string copies. NFC.Benjamin Kramer2016-05-291-2/+2
| | | | llvm-svn: 271182
* Apply clang-tidy's misc-move-constructor-init throughout Clang.Benjamin Kramer2016-05-271-3/+6
| | | | | | No functionality change intended, maybe a tiny performance improvement. llvm-svn: 270996
* [tooling] FixItHint Tooling refactoringEtienne Bergeron2016-05-112-0/+32
| | | | | | | | | | | | | | Summary: This is the refactoring to lift some FixItHint into tooling. used by: http://reviews.llvm.org/D19807 Reviewers: klimek, alexfh Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D19941 llvm-svn: 269188
* When forming a fully-qualified type name, put any qualifiers outside/before theRichard Smith2016-05-091-11/+9
| | | | | | nested-name-specifier. Patch by Sterling Augustine! llvm-svn: 268988
* [Tooling] Inject -resource-dir instead of overwriting argv[0].Benjamin Kramer2016-04-211-8/+23
| | | | | | | | | This allows using a different standard library (the one from argv[0] in the compilation database) with the correct builtins. Differential Revision: http://reviews.llvm.org/D19356 llvm-svn: 266973
* [Tooling] Fix getting fully qualified names of template alias types.Chaoren Lin2016-04-201-0/+2
| | | | | | | | | | Reviewers: rsmith, rnk Subscribers: cfe-commits, klimek Differential Revision: http://reviews.llvm.org/D19253 llvm-svn: 266925
* Added formatAndApplyAllReplacements that works on multiple files in libTooling.Eric Liu2016-03-293-9/+40
| | | | | | | | | | | | | | Summary: formatAndApplyAllReplacements takes a set of Replacements, applies them on a Rewriter, and reformats the changed code. Reviewers: klimek, djasper Subscribers: ioeric, klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D17852 llvm-svn: 264745
* Add functions to apply replacements and reformat them.Manuel Klimek2016-03-011-2/+15
| | | | | | | | | | | | | | | | This is a commonly useful feature to have, and we have implemented it multiple times with different kinds of bugs. This implementation centralizes the idea in a set of functions that we can then use from the various tools. Reverts r262234, which is a revert of r262232, and puts the functions into FOrmat.h, as they are closely coupled to clang-format, and we otherwise introduce a cyclic dependency between libFormat and libTooling. Patch by Eric Liu. llvm-svn: 262323
* Revert "Implement new interfaces for code-formatting when applying ↵Manuel Klimek2016-02-291-43/+2
| | | | | | | | replacements." This reverts commit r262232. llvm-svn: 262234
* Implement new interfaces for code-formatting when applying replacements.Manuel Klimek2016-02-291-2/+43
| | | | | | Patch by Eric Liu. llvm-svn: 262232
* Rename Action::begin() to Action::input_begin().Nico Weber2016-02-231-3/+2
| | | | | | | | Also introduce inputs() that reutnrs an llvm::iterator_range. Iterating over A->inputs() is much less mysterious than iterating over *A. No intended behavior change. llvm-svn: 261674
* Print options, if requested.Alexander Kornienko2016-02-231-0/+2
| | | | llvm-svn: 261625
* Stop using "template" when printing qualtype namesReid Kleckner2016-02-161-1/+2
| | | | | | | | | | | | | | | | Summary: The keyword "template" isn't necessary when printing a fully-qualified qualtype name, and, in fact, results in a syntax error if one tries to use it. So stop printing it. Reviewers: rsmith, rnk Subscribers: rnk, klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D17214 llvm-svn: 261005
* Remove unused includesDavid Majnemer2016-02-111-2/+0
| | | | llvm-svn: 260552
* Silence some MSVC false positive warnings about integer zexts and falling ↵Reid Kleckner2016-02-101-0/+1
| | | | | | off the end of a covered switch llvm-svn: 260411
* Add Tooling functionality to get a name for a QualType that can be used to nameRichard Smith2016-02-092-0/+433
| | | | | | | | | that type from the global scope. Patch by Sterling Augustine, derived (with permission) from code from Cling by Vassil Vassilev and Philippe Canal. llvm-svn: 260278
* Add an optional ToolName argument to ↵Benjamin Kramer2016-01-291-8/+10
| | | | | | | | | | runToolOnCodeWithArgs/buildASTFromCodeWithArgs. This can be used as a way to modify argv[0] for a clang tool. Differential Revision: http://reviews.llvm.org/D16718 llvm-svn: 259187
* Remove autoconf supportChris Bieneman2016-01-262-27/+0
| | | | | | | | | | | | | | | | | Summary: This patch is provided in preparation for removing autoconf on 1/26. The proposal to remove autoconf on 1/26 was discussed on the llvm-dev thread here: http://lists.llvm.org/pipermail/llvm-dev/2016-January/093875.html "This is the way [autoconf] ends Not with a bang but a whimper." -T.S. Eliot Reviewers: chandlerc, grosbach, bob.wilson, echristo Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D16472 llvm-svn: 258862
* Add fall-back mode for clang tools.Manuel Klimek2015-12-031-4/+7
| | | | | | | | | Run without flags if we cannot load a compilation database. This matches the behavior of clang itself when simply called with a source file. Based on a patch by Russell Wallace. llvm-svn: 254599
* Fix calculation of shifted cursor/code positions. Specifically supportDaniel Jasper2015-11-231-21/+19
| | | | | | | | | the case where a specific range is replaced by new text. Previously, the calculation would shift any position from within a replaced region to the first character after the region. This is undersirable, e.g. for clang-format's include sorting. llvm-svn: 253859
* Make ArgumentAdjuster aware of the current file being processed.Alexander Kornienko2015-11-053-9/+7
| | | | | | | | | | | | | | Summary: This is needed to handle per-project configurations when adding extra arguments in clang-tidy for example. Reviewers: klimek, djasper Subscribers: djasper, cfe-commits, klimek Differential Revision: http://reviews.llvm.org/D14191 llvm-svn: 252134
* Unbreak the shared cmake build. libToolingCore now depends on libAST.Benjamin Kramer2015-10-221-0/+1
| | | | llvm-svn: 251026
* [Tooling] Add a utility function to replace one nested name with another.Benjamin Kramer2015-10-222-0/+114
| | | | | | | | | | | | | | | | One problem in clang-tidy and other clang tools face is that there is no way to lookup an arbitrary name in the AST, that's buried deep inside Sema and might not even be what the user wants as the new name may be freshly inserted and not available in the AST. A common use case for lookups is replacing one nested name with another while minimizing namespace qualifications, so replacing 'ns::foo' with 'ns::bar' will use just 'bar' if we happen to be inside the namespace 'ns'. This adds a little helper utility for exactly that use case. Differential Revision: http://reviews.llvm.org/D13931 llvm-svn: 251022
* Roll-back r250822.Angel Garcia Gomez2015-10-202-5/+5
| | | | | | | | | | Summary: It breaks the build for the ASTMatchers Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D13893 llvm-svn: 250827
* Apply modernize-use-default to clang.Angel Garcia Gomez2015-10-202-5/+5
| | | | | | | | | | | | Summary: Replace empty bodies of default constructors and destructors with '= default'. Reviewers: bkramer, klimek Subscribers: klimek, alexfh, cfe-commits Differential Revision: http://reviews.llvm.org/D13890 llvm-svn: 250822
OpenPOWER on IntegriCloud