summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Tooling/ToolingTest.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [clang][Tooling] Filter flags that generate output in SyntaxOnlyAdjusterKadir Cetinkaya2019-11-131-0/+34
| | | | | | | | | | | | | | | | | | Summary: Flags that generate output could result in failures when creating syntax only actions. This patch introduces initial logic for filtering out those. The first such flag is "save-temps", which saves intermediate files(bitcode, assembly, etc.) into a specified directory. Fixes https://github.com/clangd/clangd/issues/191 Reviewers: hokein Subscribers: ilya-biryukov, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70173
* [Tooling] Migrated APIs that take ownership of objects to unique_ptrDmitri Gribenko2019-08-301-47/+49
| | | | | | | | | | Subscribers: jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66960 llvm-svn: 370451
* [Clang] Migrate llvm::make_unique to std::make_uniqueJonas Devlieghere2019-08-141-8/+8
| | | | | | | | | | Now that we've moved to C++14, we no longer need the llvm::make_unique implementation from STLExtras.h. This patch is a mechanical replacement of (hopefully) all the llvm::make_unique instances across the monorepo. Differential revision: https://reviews.llvm.org/D66259 llvm-svn: 368942
* [clang][ArgumentAdjusters] Do not add fsyntax-only if already existsKadir Cetinkaya2019-07-021-0/+27
| | | | | | | | | | | | Reviewers: hokein Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D64063 llvm-svn: 364904
* Range-style std::find{,_if} -> llvm::find{,_if}. NFCFangrui Song2019-03-311-4/+2
| | | | llvm-svn: 357359
* Use llvm::is_contained. NFCFangrui Song2019-02-101-1/+1
| | | | llvm-svn: 353635
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* [tooling] Add a new argument adjuster for deleting plugin related command ↵Kadir Cetinkaya2019-01-181-0/+31
| | | | | | | | | | | | | | | | line args Summary: Currently both clangd and clang-tidy makes use of this mechanism so putting it into tooling so that all tools can make use of it. Reviewers: ilya-biryukov, sammccall Subscribers: ioeric, cfe-commits Differential Revision: https://reviews.llvm.org/D56856 llvm-svn: 351531
* Lift VFS from clang to llvm (NFC)Jonas Devlieghere2018-10-101-12/+12
| | | | | | | | | | | | | | | | | | | This patch moves the virtual file system form clang to llvm so it can be used by more projects. Concretely the patch: - Moves VirtualFileSystem.{h|cpp} from clang/Basic to llvm/Support. - Moves the corresponding unit test from clang to llvm. - Moves the vfs namespace from clang::vfs to llvm::vfs. - Formats the lines affected by this change, mostly this is the result of the added llvm namespace. RFC on the mailing list: http://lists.llvm.org/pipermail/llvm-dev/2018-October/126657.html Differential revision: https://reviews.llvm.org/D52783 llvm-svn: 344140
* IWYU for llvm-config.h in clang. See r331124 for details.Nico Weber2018-04-301-1/+0
| | | | llvm-svn: 331177
* s/LLVM_ON_WIN32/_WIN32/, clangNico Weber2018-04-271-2/+2
| | | | | | | | | | | LLVM_ON_WIN32 is set exactly with MSVC and MinGW (but not Cygwin) in HandleLLVMOptions.cmake, which is where _WIN32 defined too. Just use the default macro instead of a reinvented one. See thread "Replacing LLVM_ON_WIN32 with just _WIN32" on llvm-dev and cfe-dev. No intended behavior change. llvm-svn: 331069
* Updated a usage of createTemporaryFile that does not expect file to be created.Ilya Biryukov2018-03-191-2/+2
| | | | | | | | | | | | | | | | Summary: This fixes a usage of createTemporaryFile in clang repo after a change in llvm repo. Reviewers: klimek, bkramer, krasimir, espindola, ilya-biryukov Reviewed By: ilya-biryukov Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D36828 llvm-svn: 327852
* Revert "[Tooling] [0/1] Refactor FrontendActionFactory::create() to return ↵Roman Lebedev2018-02-271-59/+52
| | | | | | | | | | | | 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-52/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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] Added a VFS parameter to ClangToolIlya Biryukov2018-01-231-0/+18
| | | | | | | | | | | | | | | | | | 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
* Do not perform the analysis based warning if the warnings are ignoredOlivier Goffart2017-11-231-0/+26
| | | | | | | | | | | | | This saves some cycles when compiling with "-w". (Also fix a potential crash on invalid code for tools that tries to recover from some errors, because analysis might compute the CFG which crashes if the code contains invalid declaration. This does not happen normally with because we also don't perform these analysis if there was an error.) Differential Revision: https://reviews.llvm.org/D40242 llvm-svn: 318900
* Fix skipping of flags in getClangStripDependencyFileAdjusterDave Lee2017-11-171-0/+31
| | | | | | | | | | | | | | | | | | 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
* Remove 'Filename' parameter from BeginSourceFileAction.Richard Smith2017-06-091-1/+1
| | | | | | | | | No-one was using this, and it's not meaningful in general -- FrontendActions can be run on inputs that don't have a corresponding source file. The current frontend input can be obtained by asking the FrontendAction if any future action actually needs it. llvm-svn: 305045
* Fix colored diagnostics from toolsOlivier Goffart2016-08-301-0/+38
| | | | | | | | | | 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
* [NFC] Header cleanupMehdi Amini2016-07-181-1/+2
| | | | | | | | | | 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
* ToolingTests/runToolOnCode.TestSkipFunctionBody: Appease msc targets.NAKAMURA Takumi2016-06-171-3/+4
| | | | llvm-svn: 272985
* Fix a few issues while skipping function bodiesOlivier Goffart2016-06-161-1/+55
| | | | | | | | | | | | | | | | | | | | - In functions with try { } catch { }, only the try block would be skipped, not the catch blocks - The template functions would still be parsed. - The initializers within a constructor would still be parsed. - The inline functions within class would still be stored, only to be discared later. - Invalid code with try would assert (as in "int foo() try assert_here") This attempt to do even less while skipping function bodies. Differential Revision: http://reviews.llvm.org/D20821 llvm-svn: 272963
* 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
OpenPOWER on IntegriCloud