summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Tooling
Commit message (Collapse)AuthorAgeFilesLines
* [Tooling] Fix getting fully qualified names of template alias types.Chaoren Lin2016-04-201-1/+8
| | | | | | | | | | 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-292-1/+36
| | | | | | | | | | | | | | 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
* Turning on the /bigobj flag for two more files that will not link with MSVC ↵Aaron Ballman2016-03-081-0/+6
| | | | | | 2015 Win64 Debug due to the section limit. llvm-svn: 262938
* Add functions to apply replacements and reformat them.Manuel Klimek2016-03-011-0/+19
| | | | | | | | | | | | | | | | 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-292-50/+0
| | | | | | | | replacements." This reverts commit r262232. llvm-svn: 262234
* Implement new interfaces for code-formatting when applying replacements.Manuel Klimek2016-02-292-0/+50
| | | | | | Patch by Eric Liu. llvm-svn: 262232
* Stop using "template" when printing qualtype namesReid Kleckner2016-02-161-1/+7
| | | | | | | | | | | | | | | | 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
* Add Tooling functionality to get a name for a QualType that can be used to nameRichard Smith2016-02-092-0/+167
| | | | | | | | | 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
* Remove autoconf supportChris Bieneman2016-01-261-20/+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
* Let RecursiveASTVisitor visit array index VarDeclsNico Weber2016-01-221-0/+19
| | | | | | | | | | | | An implicit copy ctor creates loop VarDecls that hang off CXXCtorInitializer. RecursiveASTVisitor used to not visit them, so that they didn't show up in the parent map used by ASTMatchers, causing asserts() when the implicit DeclRefExpr() in a CXXCtorInitializer referred to one of these VarDecls. Fixes PR26227. http://reviews.llvm.org/D16413 llvm-svn: 258503
* Replace some tabs with spaces.Nico Weber2016-01-221-4/+3
| | | | llvm-svn: 258500
* Fix calculation of shifted cursor/code positions. Specifically supportDaniel Jasper2015-11-231-6/+15
| | | | | | | | | 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-051-1/+1
| | | | | | | | | | | | | | 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
* [Tooling] Add a utility function to replace one nested name with another.Benjamin Kramer2015-10-222-0/+109
| | | | | | | | | | | | | | | | 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-203-4/+4
| | | | | | | | | | 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-203-4/+4
| | | | | | | | | | | | 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
* Revert accidental commit. This isn't ready yet.Benjamin Kramer2015-10-201-1/+0
| | | | llvm-svn: 250804
* Put back dead code that's used out-of-tree.Benjamin Kramer2015-10-201-0/+1
| | | | | | Partially reverts r250418. llvm-svn: 250803
* [VFS] Port tooling to use the in-memory file system.Benjamin Kramer2015-10-091-9/+24
| | | | | | | | | | This means file remappings can now be managed by ClangTool (or a ToolInvocation user) instead of by ToolInvocation itself. The ToolInvocation remapping is still in place so users can migrate. Differential Revision: http://reviews.llvm.org/D13474 llvm-svn: 249815
* ToolingTests: Tweak getAnyTarget() to match "x86_64".NAKAMURA Takumi2015-10-061-3/+5
| | | | | | Both "x86" and "x86-64" are incompatible to triple's arch. llvm-svn: 249403
* Adds a way for tools to deduce the target config from a compiler name.Manuel Klimek2015-10-062-0/+81
| | | | | | | | | | | | | Adds `addTargetAndModeForProgramName`, a utility function that will add appropriate `-target foo` and `--driver-mode=g++` tokens to a command line for driver invocations of the form `a/b/foo-g++`. It is intended to support tooling: for example, should a compilation database record some invocation of `foo-g++` without these implicit flags, a Clang tool may use this function to add them back. Patch by Luke Zarko. llvm-svn: 249391
* [VFS] Add an in-memory file system implementation.Benjamin Kramer2015-10-051-11/+18
| | | | | | | | | | This is a simple file system tree of memory buffers that can be filled by a client. In conjunction with an OverlayFS it can be used to make virtual files accessible right next to physical files. This can be used as a replacement for the virtual file handling in FileManager and which I intend to remove eventually. llvm-svn: 249315
* clang-format: Add initial #include sorting capabilities.Daniel Jasper2015-09-231-0/+93
| | | | | | | | | To implement this nicely, add a function that merges two sets of replacements that are meant to be done in sequence. This functionality will also be useful for other applications, e.g. formatting the result of clang-tidy fixes. llvm-svn: 248367
* [tooling] Provide the compile commands of the JSON database in the order ↵Argyrios Kyrtzidis2015-09-221-0/+19
| | | | | | | | | | | that they were provided in the JSON file. This is useful for debugging of issues and reduction of test cases. For example, an issue may show up due to the order that some commands were processed. It is convenient to be able to remove commands from the file and still preserve the order that they are returned, instead of getting a completely different order when removing a few commands. llvm-svn: 248292
* Rename AST node matchers to match the AST node names directly. Part of this ↵Aaron Ballman2015-09-171-2/+2
| | | | | | rename also splits recordDecl() (which used to match CXXRecordDecl) into recordDecl() (that matches RecordDecl) and cxxRecordDecl (that matches CXXRecordDecl). Also adds isStruct(), isUnion(), and isClass() narrowing matchers for RecordDecl objects. llvm-svn: 247885
* [tooling] Add unit tests for change in r247468.Argyrios Kyrtzidis2015-09-161-3/+7
| | | | llvm-svn: 247832
* Fix performance regression when running clang tools.Manuel Klimek2015-09-081-1/+3
| | | | | | | Brings tool start time for a large synthetic test case down from (on my machine) 4 seconds to 0.5 seconds. llvm-svn: 247018
* Add structed way to express command line options in the compilation database.Manuel Klimek2015-08-141-1/+24
| | | | | | | | | | | | | | | | | | | | Currently, arguments are passed via the string attribute 'command', assuming a shell-escaped / quoted command line to extract the original arguments. This works well enough on Unix systems, but turns out to be problematic for Windows tools to generate. This CL adds a new attribute 'arguments', an array of strings, which specifies the exact command line arguments. If 'arguments' is available in the compilation database, it is preferred to 'commands'. Currently there is no plan to retire 'commands': there are enough different use cases where users want to create their own mechanism for creating compilation databases, that it doesn't make sense to force them all to implement shell command line parsing. Patch by Daniel Dilts. llvm-svn: 245036
* Wdeprecated: CommentVerifiers are returned by value, make sure they're ↵David Blaikie2015-08-131-0/+4
| | | | | | correctly copy/moveable llvm-svn: 244958
* Revert r240270 ("Fixed/added namespace ending comments using clang-tidy").Alexander Kornienko2015-06-222-2/+2
| | | | llvm-svn: 240353
* Fixed/added namespace ending comments using clang-tidy. NFCAlexander Kornienko2015-06-222-2/+2
| | | | | | | | | | | | The patch is generated using this command: $ tools/extra/clang-tidy/tool/run-clang-tidy.py -fix \ -checks=-*,llvm-namespace-comment -header-filter='llvm/.*|clang/.*' \ work/llvm/tools/clang To reduce churn, not touching namespaces spanning less than 10 lines. llvm-svn: 240270
* Avoid using set::emplace as it is apparently not supported by gcc 4.7.Daniel Jasper2015-06-161-2/+2
| | | | llvm-svn: 239816
* Tooling: When applying a set of replacements, do deletions beforeDaniel Jasper2015-06-161-0/+13
| | | | | | | | insertions. It is unlikely to be the intention to delete parts of newly inserted code. To do so, changed sorting Replacements at the same offset to have decreasing length. llvm-svn: 239809
* Allow replacements created from token ranges to specify language options.Manuel Klimek2015-06-031-0/+25
| | | | | | | | The default language options will lead to incorrect replacements in C++ code, for example when trying to replace nested name specifiers ending in "::". llvm-svn: 238922
* Use 'override/final' instead of 'virtual' for overridden methodsAlexander Kornienko2015-04-115-30/+28
| | | | | | | | | | | | | | | | | | | | Summary: The patch is generated using clang-tidy misc-use-override check. This command was used: tools/clang/tools/extra/clang-tidy/tool/run-clang-tidy.py \ -checks='-*,misc-use-override' -header-filter='llvm|clang' -j=32 -fix Reviewers: dblaikie Reviewed By: dblaikie Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D8926 llvm-svn: 234678
* Revert "Wrap clang module files in a Mach-O, ELF, or COFF container."Adrian Prantl2015-02-251-3/+2
| | | | llvm-svn: 230454
* Wrap clang module files in a Mach-O, ELF, or COFF container.Adrian Prantl2015-02-251-2/+3
| | | | | | | | | | | | | | | | | This is a necessary prerequisite for debugging with modules. The .pcm files become containers that hold the serialized AST which allows us to store debug information in the module file that can be shared by all object files that were built importing the module. This reapplies r230044 with a fixed configure+make build and updated dependencies and testcase requirements. Over the last iteration this version adds - missing target requirements for testcases that specify an x86 triple, - a missing clangCodeGen.a dependency to libClang.a in the make build. rdar://problem/19104245 llvm-svn: 230423
* Revert "Wrap clang module files in a Mach-O, ELF, or COFF container."Adrian Prantl2015-02-241-3/+2
| | | | | | | This reverts commit r230305. Off to fix another round of missing dependencies on various platforms. llvm-svn: 230309
* Wrap clang module files in a Mach-O, ELF, or COFF container.Adrian Prantl2015-02-241-2/+3
| | | | | | | | | | | | | | This is a necessary prerequisite for debugging with modules. The .pcm files become containers that hold the serialized AST which allows us to store debug information in the module file that can be shared by all object files that were built importing the module. rdar://problem/19104245 This reapplies r230044 with a fixed configure+make build and updated dependencies. Take 3. llvm-svn: 230305
* Revert "Wrap clang module files in a Mach-O, ELF, or COFF container."Adrian Prantl2015-02-211-3/+2
| | | | | | | | This reverts commit 230099. The Linux configure+make build variant still needs some work. llvm-svn: 230103
* Wrap clang module files in a Mach-O, ELF, or COFF container.Adrian Prantl2015-02-201-2/+3
| | | | | | | | | | | | | | This is a necessary prerequisite for debugging with modules. The .pcm files become containers that hold the serialized AST which allows us to store debug information in the module file that can be shared by all object files that were built importing the module. rdar://problem/19104245 This reapplies r230044 with a fixed configure+make build and updated dependencies. Take 2. llvm-svn: 230089
* Revert "Wrap clang module files in a Mach-O, ELF, or COFF container."Adrian Prantl2015-02-201-3/+2
| | | | | | | | This reverts commit r230067. Investigating another batch of problems found by the bots. llvm-svn: 230073
* Wrap clang module files in a Mach-O, ELF, or COFF container.Adrian Prantl2015-02-201-2/+3
| | | | | | | | | | | | | | This is a necessary prerequisite for debugging with modules. The .pcm files become containers that hold the serialized AST which allows us to store debug information in the module file that can be shared by all object files that were built importing the module. rdar://problem/19104245 This reapplies r230044 with a fixed configure+make build and updated dependencies. llvm-svn: 230067
* Make ArgumentsAdjuster an std::function.Alexander Kornienko2014-12-031-22/+11
| | | | | | | | | | | | Reviewers: klimek Reviewed By: klimek Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D6505 llvm-svn: 223248
* Standardize on StringMap::insert, removing uses of StringMap::GetOrCreateValue.David Blaikie2014-11-192-2/+4
| | | | llvm-svn: 222306
* [CMake] Add dependencies on clangToolingCore.NAKAMURA Takumi2014-10-301-0/+1
| | | | llvm-svn: 220890
* Refactor libTooling to reduce required dependencies.Daniel Jasper2014-10-291-1/+2
| | | | | | | | | | This moves classes for storing and applying replacements to separate files. These classes specifically are used by clang-format which doesn't have any other dependencies on clangAST. Thereby, the size of clang-format's binary can be cut roughly in half and its build time sped up. llvm-svn: 220867
* Make VFS and FileManager match the current MemoryBuffer API.Benjamin Kramer2014-10-262-6/+4
| | | | | | | This eliminates converting back and forth between the 3 formats and gives us a more homogeneous interface. llvm-svn: 220657
* Fix initializing TypeOfTypeLocOlivier Goffart2014-10-241-0/+11
| | | | | | | | | | | This fixes a crash in the RecursiveASTVisitor on such code __typeof__(struct F*) var[invalid]; The UnderlyingTInfo of a TypeOfTypeLoc was left uninitialized when created from ASTContext::getTrivialTypeSourceInfo This lead to a crash in RecursiveASTVisitor when trying to access it. llvm-svn: 220562
* Separated RecursiveASTVisitorTest into multiple files.Manuel Klimek2014-10-097-514/+585
| | | | | | Patch by Marek Kurdej. llvm-svn: 219410
OpenPOWER on IntegriCloud