summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Tooling/ToolingTest.cpp
Commit message (Collapse)AuthorAgeFilesLines
* 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
* [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-061-0/+80
| | | | | | | | | | | | | 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
* Use 'override/final' instead of 'virtual' for overridden methodsAlexander Kornienko2015-04-111-14/+12
| | | | | | | | | | | | | | | | | | | | 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
* 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
* Adds 'override' to overriding methods. NFC.Fariborz Jahanian2014-10-011-1/+1
| | | | | | These were uncoveredby my yet undelivered patch. llvm-svn: 218774
* Recommit 213307: unique_ptr-ify ownership of ASTConsumers (reverted in r213325)David Blaikie2014-08-101-22/+28
| | | | | | | | After post-commit review and community discussion, this seems like a reasonable direction to continue, making ownership semantics explicit in the source using the type system. llvm-svn: 215323
* Revert "unique_ptr-ify ownership of ASTConsumers"David Blaikie2014-07-171-28/+22
| | | | | | | | | This reverts commit r213307. Reverting to have some on-list discussion/confirmation about the ongoing direction of smart pointer usage in the LLVM project. llvm-svn: 213325
* unique_ptr-ify ownership of ASTConsumersDavid Blaikie2014-07-171-22/+28
| | | | | | | | | (after fixing a bug in MultiplexConsumer I noticed the ownership of the nested consumers was implemented with raw pointers - so this fixes that... and follows the source back to its origin pushing unique_ptr ownership up through there too) llvm-svn: 213307
* Track IntrusiveRefCntPtr::get() changes from LLVM r212366Alp Toker2014-07-051-2/+2
| | | | llvm-svn: 212369
* [C++11] Use 'nullptr'. Unittests edition.Craig Topper2014-06-081-3/+3
| | | | llvm-svn: 210423
* Remove the last remaining llvm/Config/config.h includesAlp Toker2014-06-041-1/+1
| | | | | | | | | | | | This corrects long-standing misuses of LLVM's internal config.h. In most cases the public llvm-config.h header was intended and we can now remove the old hacks thanks to LLVM r210144. The config.h header is private, won't be installed and should no longer be included by clang or other modules. llvm-svn: 210145
* Push unique_ptr ownership of ASTUnits further back into their factories.David Blaikie2014-04-251-2/+2
| | | | llvm-svn: 207237
* Improve ownership of ASTUnits in libTooling by using std::unique_ptr.David Blaikie2014-04-251-5/+2
| | | | llvm-svn: 207229
* fix a test-only leak found by lsan, PR19521Kostya Serebryany2014-04-251-0/+1
| | | | llvm-svn: 207223
* Fix four more test-only leaks found by LSan.Nico Weber2014-04-241-4/+11
| | | | | | Tool::run() doesn't take ownership of the passed action. llvm-svn: 207071
* Check for LLVM_ON_WIN32 instead of _WIN32.Hans Wennborg2014-03-121-2/+3
| | | | | | This is a follow-up to r203624 to address Anton's comment. llvm-svn: 203668
* Replace OwningPtr with std::unique_ptr.Ahmed Charles2014-03-071-5/+5
| | | | | | This compiles cleanly with lldb/lld/clang-tools-extra/llvm. llvm-svn: 203279
* MSVC 2012 doesn't support std::initializer_list at all, so don't rely onPeter Collingbourne2014-03-031-2/+6
| | | | | | that std::vector constructor. llvm-svn: 202684
* MSVC cannot understand temporaries formed from initializer lists.Peter Collingbourne2014-03-031-3/+3
| | | | llvm-svn: 202682
* Disable all dependency output options when using the Tooling library.Peter Collingbourne2014-03-021-0/+11
| | | | | | | | | | | | | | It isn't appropriate for a tool to be stomping over the dependency files, especially if the actual build uses a compiler other than Clang or the tool cannot find all the headers for some reason (which would cause the existing dependency file to be deleted). If a tool actually needs to care about dependency files we can think about adding a mechanism for getting to this information. Differential Revision: http://llvm-reviews.chandlerc.com/D2912 llvm-svn: 202669
* Switch all uses of LLVM_OVERRIDE to just use 'override' directly.Craig Topper2014-03-021-2/+2
| | | | llvm-svn: 202625
* Sort all the #include lines with LLVM's utils/sort_includes.py whichChandler Carruth2014-01-071-1/+1
| | | | | | | encodes the canonical rules for LLVM's style. I noticed this had drifted quite a bit when cleaning up LLVM, so wanted to clean up Clang as well. llvm-svn: 198686
* Revert "ToolingTest.cpp: Fix r158592, ↵Alp Toker2014-01-041-5/+0
| | | | | | | | | | | runToolOnCode.FindsNoTopLevelDeclOnEmptyCode on msvc. LangOpts.MicrosoftExt still appends "class type_info;"." type_info has been made an implicitly predeclared type in r198497 and will no longer appear as a user-declared type so we can remove this old hack. This reverts commit r158595. llvm-svn: 198502
* unittests/Tooling/ToolingTest.cpp: Suppress new tests on win32, due to ↵NAKAMURA Takumi2013-11-131-1/+1
| | | | | | handling of virtual file, such "/a.cc". llvm-svn: 194534
* Add test for injecting diagnostic consumers into a ClangTool.Manuel Klimek2013-11-121-0/+12
| | | | | | As suggested by pcc on 194226. llvm-svn: 194494
* Adds the ability to inject a DiagnosticConsumer into ClangTools.Manuel Klimek2013-11-071-0/+19
| | | | llvm-svn: 194226
* Disable a tooling test on Windows.Peter Collingbourne2013-11-061-0/+2
| | | | llvm-svn: 194178
* Introduce ClangTool::buildASTs, and buildASTFromCode.Peter Collingbourne2013-11-061-4/+50
| | | | | | | | | | | | | | | | | | | | | These allow clients to retrieve persistent AST objects (ASTUnits) which can be used in an ad-hoc manner after parsing. To accommodate this change, the code for processing a CompilerInvocation using a FrontendAction has been factored out to FrontendActionFactory, and a new base class, ToolAction, has been introduced, allowing the tool to do arbitrary things with each CompilerInvocation. This change was necessary because ASTUnit does not use the FrontendAction interface directly. This change also causes the FileManager in ClangTool to use shared ownership. This will become necessary because ASTUnit takes shared ownership of FileManager (ClangTool's FileManager is currently unused by ASTUnit; this is a FIXME). As shown in the tests, any client of ToolInvocation will need to be modified to use shared ownership for FileManager. Differential Revision: http://llvm-reviews.chandlerc.com/D2097 llvm-svn: 194164
* Use the same SourceManager for ModuleMaps and compilations.Manuel Klimek2013-10-241-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows using virtual file mappings on the original SourceManager to map in virtual module.map files. Without this patch, the ModuleMap search will find a module.map file (as the FileEntry exists in the FileManager), but will be unable to get the content from the SourceManager (as ModuleMap previously created its own SourceManager). Two problems needed to be fixed which this patch exposed: 1. Storing the inferred module map When writing out a module, the ASTWriter stores the names of the files in the main source manager; when loading the AST again, the ASTReader errs out if such a file is found missing, unless it is overridden. Previously CompilerInstance's compileModule method would store the inferred module map to a temporary file; the problem with this approach is that now that the module map is handled by the main source manager, the ASTWriter stores the name of the temporary module map as source to the compilation; later, when the module is loaded, the temporary file has already been deleted, which leads to a compilation error. This patch changes the inferred module map to instead inject a virtual file into the source manager. This both saves some disk IO, and works with how the ASTWriter/ASTReader handle overridden source files. 2. Changing test input in test/Modules/Inputs/* Now that the module map file is handled by the main source manager, the VerifyDiagnosticConsumer will not ignore diagnostics created while parsing the module map file. The module test test/Modules/renamed.m uses -I test/Modules/Inputs and triggers recursive loading of all module maps in test/Modules/Inputs, some of which had conflicting names, thus leading errors while parsing the module maps. Those diagnostics already occur on trunk, but before this patch they would not break the test, as they were ignored by the VerifyDiagnosticConsumer. This patch thus changes the module maps that have been recently introduced which broke the invariant of compatible modules maps in test/Modules/Inputs. llvm-svn: 193314
* Enables chaining of argument adjusters in clang tools.Manuel Klimek2013-06-041-0/+41
| | | | | | | | This enables changing clang-check to get extra arguments. Patch by Pavel Labath. llvm-svn: 183227
* Coding style fix for SourceFileCallbacksEdwin Vane2013-05-301-3/+3
| | | | llvm-svn: 182930
* Tooling: Call back for both begin and end of sourcesEdwin Vane2013-05-291-7/+14
| | | | | | | | | | | | newFrontendActionFactory() took a pointer to a callback to call when a source file was done being processed by an action. This revision updates the callback to include an ante-processing callback as well. Callback-providing class renamed and callback functions themselves renamed. Functions are no longer pure-virtual so users aren't forced to implement both callbacks if one isn't needed. llvm-svn: 182864
* Fix a typo in the name of a tooling unit testHal Finkel2013-01-281-1/+1
| | | | llvm-svn: 173658
* Remove useless 'llvm::' qualifier from names like StringRef and others that areDmitri Gribenko2013-01-121-6/+6
| | | | | | brought into 'clang' namespace by clang/Basic/LLVM.h llvm-svn: 172323
* Allow an ASTConsumer to selectively skip function bodies while parsing. PatchRichard Smith2012-11-271-0/+24
| | | | | | by Olivier Goffart! llvm-svn: 168726
* unittests/ToolingTest.cpp: Suppress ↵NAKAMURA Takumi2012-10-251-0/+2
| | | | | | newFrontendActionFactory.InjectsEndOfSourceFileCallback on Win32 for now. Investigating. llvm-svn: 166674
* Adds the possibility to inject a callback that's called after each ↵Manuel Klimek2012-10-251-0/+30
| | | | | | | | translation unit is processed. This is important when one wants to deduplicate results during one run over a translation unit by pointer identity of AST nodes. llvm-svn: 166671
* Adapts the FrontendAction convenience functions so that it can beManuel Klimek2012-07-051-1/+3
| | | | | | | | used with classes that generate ASTConsumers; this allows decoupling the ASTConsumer generation from the Frontend library (like, for example, the MatchFinder in the upcoming ASTMatcher patch). llvm-svn: 159760
* ToolingTest.cpp: Fix r158592, runToolOnCode.FindsNoTopLevelDeclOnEmptyCode ↵NAKAMURA Takumi2012-06-161-0/+5
| | | | | | on msvc. LangOpts.MicrosoftExt still appends "class type_info;". llvm-svn: 158595
* Explicitly build __builtin_va_list.Meador Inge2012-06-161-2/+2
| | | | | | | The target specific __builtin_va_list types are now explicitly built instead of injecting strings into the preprocessor input. llvm-svn: 158592
* Revert r157819, "#ifdef out a broken test on win32"NAKAMURA Takumi2012-06-021-5/+0
| | | | | | FYI, LLVM_ON_WIN32 is useless. llvm-svn: 157890
* #ifdef out a broken test on win32Alexander Kornienko2012-06-011-0/+5
| | | | llvm-svn: 157819
* Added a test for ToolInvocation::mapVirtualFile method.Alexander Kornienko2012-06-011-0/+14
| | | | llvm-svn: 157812
* Adds a tooling library.Manuel Klimek2012-04-041-0/+113
| | | | | | | | | | | | | | | Provides an API to run clang tools (FrontendActions) as standalone tools, or repeatedly in-memory in a process. This is useful for unit-testing, map-reduce style applications, source transformation daemons or command line tools. The ability to run over multiple translation units with different command line arguments enables building up refactoring tools that need to apply transformations across translation unit boundaries. See tools/clang-check/ClangCheck.cpp for an example. llvm-svn: 154008
* Reverts the Tooling changes as requested by Chris.Manuel Klimek2011-06-021-175/+0
| | | | llvm-svn: 132462
* This is the next step in building the standalone tools infrastructure:Manuel Klimek2011-04-271-0/+84
| | | | | | | | | | | | | | | This patch simplifies writing of standalone Clang tools. As an example, we add clang-check, a tool that runs a syntax only frontend action over a .cc file. When you integrate this into your favorite editor, you get much faster feedback on your compilation errors, thus reducing your feedback cycle especially when writing new code. The tool depends on integration of an outstanding patch to CMake to work which allows you to always have a current compile command database in your cmake output directory when you set CMAKE_EXPORT_COMPILE_COMMANDS. llvm-svn: 130306
* Adds a function to run FrontendActions over in-memory code. This isManuel Klimek2011-04-211-0/+91
the first step towards a standalone Clang tool infrastructure. The plan is to make it easy to build command line tools that run over the AST of source files in a project outside of the build system. llvm-svn: 129924
OpenPOWER on IntegriCloud