summaryrefslogtreecommitdiffstats
path: root/clang/lib/Tooling/Tooling.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* [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
* 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
* 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
* Roll-back r250822.Angel Garcia Gomez2015-10-201-3/+3
| | | | | | | | | | 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-201-3/+3
| | | | | | | | | | | | 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
* [VFS] Wire up driver VFS through tooling.Benjamin Kramer2015-10-091-4/+5
| | | | | | | | Sadly I don't currently have a way to tests this as the driver is always initialized with the default triple and finding system headers is system specific. llvm-svn: 249831
* [VFS] Port tooling to use the in-memory file system.Benjamin Kramer2015-10-091-20/+52
| | | | | | | | | | 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
* [Tooling] Don't run a tool invocation without a FileManager.Benjamin Kramer2015-10-061-1/+3
| | | | | | Fixes a crash regression from r249410. llvm-svn: 249413
* [Tooling] Reuse FileManager in ASTUnit.Benjamin Kramer2015-10-061-2/+2
| | | | | | | | ASTUnit was creating multiple FileManagers and throwing them away. Reuse the one from Tooling. No functionality change now but necessary for VFSifying tooling. llvm-svn: 249410
* Adds a way for tools to deduce the target config from a compiler name.Manuel Klimek2015-10-061-0/+26
| | | | | | | | | | | | | 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
* Revert r240270 ("Fixed/added namespace ending comments using clang-tidy").Alexander Kornienko2015-06-221-2/+2
| | | | llvm-svn: 240353
* Fixed/added namespace ending comments using clang-tidy. NFCAlexander Kornienko2015-06-221-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
* Introduce a PCHContainerOperations interface (NFC).Adrian Prantl2015-06-201-43/+52
| | | | | | | | | | | | | | | | A PCHContainerOperations abstract interface provides operations for creating and unwrapping containers for serialized ASTs (precompiled headers and clang modules). The default implementation is RawPCHContainerOperations, which uses a flat file for the output. The main application for this interface will be an ObjectFilePCHContainerOperations implementation that uses LLVM to wrap the module in an ELF/Mach-O/COFF container to store debug info alongside the AST. rdar://problem/20091852 llvm-svn: 240225
* Make the clang-fuzzer use the CompilerInstance directly.Manuel Klimek2015-03-281-1/+1
| | | | | | Going through the driver is too slow. llvm-svn: 233459
* Make ArgumentsAdjuster an std::function.Alexander Kornienko2014-12-031-7/+10
| | | | | | | | | | | | Reviewers: klimek Reviewed By: klimek Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D6505 llvm-svn: 223248
* Re-apply r222646 (was reverted in r222667). Adding 4 ASTMatchers: ↵Manuel Klimek2014-11-251-3/+11
| | | | | | | | | | | | | | | | | | | | | | | typedefDecl, isInMainFile, isInSystemFile, isInFileMatchingName Change to original: ifndef out tests in Windows due to /-separated paths. Summary: Often one is only interested in matches within the main-file or matches that are not within a system-header, for which this patch adds isInMainFile and isInSystemFile. They take no arguments and narrow down the matches. The isInFileMatchingName is mainly thought for interactive clang-query-sessions, to make a matcher more specific without restarting the session with the files you are interested in for that moment. It takes a string that will be used as regular-expression to match the filename of where the matched node is expanded. Patch by Hendrik von Prince. llvm-svn: 222765
* Reverting r222646; the tests do not pass on Windows. Also reverts r222664, ↵Aaron Ballman2014-11-241-11/+3
| | | | | | which was required for r222646 to compile with Visual Studio 2012. llvm-svn: 222667
* Adding 4 ASTMatchers: typedefDecl, isInMainFile, isInSystemFile, ↵Manuel Klimek2014-11-241-3/+11
| | | | | | | | | | | | | | | | | | | | isInFileMatchingName Summary: Often one is only interested in matches within the main-file or matches that are not within a system-header, for which this patch adds isInMainFile and isInSystemFile. They take no arguments and narrow down the matches. The isInFileMatchingName is mainly thought for interactive clang-query-sessions, to make a matcher more specific without restarting the session with the files you are interested in for that moment. It takes a string that will be used as regular-expression to match the filename of where the matched node is expanded. Patch by Hendrik von Prince. llvm-svn: 222646
* [Tooling] Restore current directory after processing each file.Alexander Kornienko2014-11-101-2/+17
| | | | | | | | | | | | | | | | | | Summary: If we actually change directory before processing a file, we need to restore it afterwards. This was broken in r216620. Added a comment for the changes in r216620. Reviewers: klimek Reviewed By: klimek Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D6162 llvm-svn: 221600
* Driver: Use pointee_iterator rather than iterating over unique_ptrsJustin Bogner2014-10-031-2/+2
| | | | | | | | There's probably never a good reason to iterate over unique_ptrs. This lets us use range-for and say Job.foo instead of (*it)->foo in a few places. llvm-svn: 218938
* Clean up ClangTool's argument adjuster handling a bit with unique_ptr.Benjamin Kramer2014-09-241-18/+5
| | | | | | Make the dtor non-virtual while there. No functionality change. llvm-svn: 218379
* unique_ptrify JobList::JobsDavid Blaikie2014-09-041-5/+5
| | | | llvm-svn: 217168
* Query CompilationDatabase right before running each compilation.Alexander Kornienko2014-08-271-49/+44
| | | | | | | | | | | | | | | | | Summary: Query CompilationDatabase right before running each compilation. This allows supporting compilation databases that change external state required for successful compilation. Reviewers: klimek, djasper Reviewed By: djasper Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D5086 llvm-svn: 216620
* Update for LLVM api change.Rafael Espindola2014-08-271-2/+4
| | | | llvm-svn: 216585
* Track IntrusiveRefCntPtr::get() changes from LLVM r212366Alp Toker2014-07-051-2/+2
| | | | llvm-svn: 212369
* Replace llvm::error_code with std::error_code.Rafael Espindola2014-06-121-1/+1
| | | | llvm-svn: 210780
* 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
* [C++11] Use 'nullptr'. Tooling edition.Craig Topper2014-05-201-8/+9
| | | | llvm-svn: 209192
* Tooling: use stderr, not stdout for missing command line messagesAlp Toker2014-05-161-2/+2
| | | | | | Matches other tooling output that use stderr. llvm-svn: 208988
* Eliminate DefaultImageName from the Driver constructorAlp Toker2014-05-151-3/+1
| | | | | | | | | | | | All callers were passing in "a.out" or garbage so a sensible default works fine here as a cleanup. This also brings about the possibility of adapting the value based on the driver's compatibility mode in future. The setting can still be changed via Driver::DefaultImageName as needed. llvm-svn: 208926
* Push unique_ptr ownership of ASTUnits further back into their factories.David Blaikie2014-04-251-7/+9
| | | | llvm-svn: 207237
* Improve ownership of ASTUnits in libTooling by using std::unique_ptr.David Blaikie2014-04-251-8/+8
| | | | llvm-svn: 207229
* [Modules] Update Clang's two files that use DEBUG(...) without definingChandler Carruth2014-04-211-0/+2
| | | | | | DEBUG_TYPE to do so. LLVM's Debug.h requires this as of r206822. llvm-svn: 206823
* Tooling: Move heavyweight vectors around instead of copying.Benjamin Kramer2014-03-201-32/+27
| | | | | | While there convert to range-based for loops. No functionality change. llvm-svn: 204338
* [C++11] Add 'override' keyword to virtual methods that override their base ↵Craig Topper2014-03-151-2/+2
| | | | | | class. llvm-svn: 203999
* Check for LLVM_ON_WIN32 instead of _WIN32.Hans Wennborg2014-03-121-1/+2
| | | | | | 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
* Change OwningPtr::take() to OwningPtr::release().Ahmed Charles2014-03-071-1/+1
| | | | | | This is a precursor to moving to std::unique_ptr. llvm-svn: 203275
* Disable all dependency output options when using the Tooling library.Peter Collingbourne2014-03-021-0/+1
| | | | | | | | | | | | | | 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
* Adds the ability to inject a DiagnosticConsumer into ClangTools.Manuel Klimek2013-11-071-14/+30
| | | | llvm-svn: 194226
* Introduce ClangTool::buildASTs, and buildASTFromCode.Peter Collingbourne2013-11-061-35/+119
| | | | | | | | | | | | | | | | | | | | | 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
* Move Compilation::PrintJob and PrintDiagnosticJob into Job::Print.Hans Wennborg2013-09-121-2/+2
| | | | | | | | | | | | | | | | | This moves the code to Job.cpp, which seems like a more natural fit, and replaces the "is this a JobList? is this a Command?" logic with a virtual function call. It also removes the code duplication between PrintJob and PrintDiagnosticJob and simplifies the code a little. There's no functionality change here, except that the Executable is now always printed within quotes, whereas it would previously not be quoted in crash reports, which I think was a bug. Differential Revision: http://llvm-reviews.chandlerc.com/D1653 llvm-svn: 190620
* Simplify code with the in place path::native. No functionality change.Benjamin Kramer2013-09-111-3/+2
| | | | llvm-svn: 190515
* Fix warning in builds without asserts.Rafael Espindola2013-08-101-0/+1
| | | | llvm-svn: 188132
* Simplify now that llvm::sys::current_path checks $PWD.Rafael Espindola2013-08-101-12/+5
| | | | llvm-svn: 188128
* Remove unused include.Rafael Espindola2013-06-261-1/+0
| | | | llvm-svn: 184936
* Use llvm::sys::fs::getMainExecutable.Rafael Espindola2013-06-261-1/+1
| | | | llvm-svn: 184915
* In tooling, reenable freeing of datastructures in codegen, just as we do forNick Lewycky2013-06-251-0/+1
| | | | | | the frontend. We don't want to respect the -disable-free flag here. llvm-svn: 184861
* Include PathV1.h only where it is used.Rafael Espindola2013-06-171-0/+1
| | | | llvm-svn: 184090
* [Driver] Refactor clang driver to use LLVM's Option libraryReid Kleckner2013-06-141-3/+4
| | | | | | | | | | | | | | | | | | The big changes are: - Deleting Driver/(Arg|Opt)* - Rewriting includes to llvm/Option/ and re-sorting - 'using namespace llvm::opt' in clang::driver - Fixing the autoconf build by adding option everywhere As discussed in the review, this change includes using directives in header files. I'll make follow up changes to remove those in favor of name specifiers. Reviewers: espindola Differential Revision: http://llvm-reviews.chandlerc.com/D975 llvm-svn: 183989
OpenPOWER on IntegriCloud