summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Tooling
Commit message (Collapse)AuthorAgeFilesLines
* 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
* Adds 'override' to overriding methods. NFC.Fariborz Jahanian2014-10-011-1/+1
| | | | | | These were uncoveredby my yet undelivered patch. llvm-svn: 218774
* Tooling: Ignore file names in tooling::deduplicate.Benjamin Kramer2014-09-091-2/+6
| | | | | | | | | | | This was horribly broken due to how the sort predicate works. We would report a conflict for files with a replacement in the same position but different names if the length differed. Just ignore paths as this is often what the user wants. Files can occur with different names (due to symlinks or relative paths) and we don't ever want to do the same edit in one file twice. llvm-svn: 217439
* Overload SourceManager::overrideFileContents so that unconditionally passing ↵David Blaikie2014-08-271-1/+1
| | | | | | | | | | ownership is explicitly done using unique_ptr. Only those callers who are dynamically passing ownership should need the 3 argument form. Those accepting the default ("do pass ownership") should do so explicitly with a unique_ptr now. llvm-svn: 216614
* Update for LLVM api change.Rafael Espindola2014-08-271-2/+3
| | | | llvm-svn: 216585
* Header guard canonicalization, clang part.Benjamin Kramer2014-08-132-4/+4
| | | | | | Modifications made by clang-tidy with minor tweaks. llvm-svn: 215557
* Recommit 213307: unique_ptr-ify ownership of ASTConsumers (reverted in r213325)David Blaikie2014-08-103-28/+35
| | | | | | | | 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-173-35/+28
| | | | | | | | | 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-173-28/+35
| | | | | | | | | (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
* Make clang's rewrite engine a core featureAlp Toker2014-07-162-2/+2
| | | | | | | | | | | | | | | The rewrite facility's footprint is small so it's not worth going to these lengths to support disabling at configure time, particularly since key compiler features now depend on it. Meanwhile the Objective-C rewriters have been moved under the ENABLE_CLANG_ARCMT umbrella for now as they're comparatively heavy and still potentially worth excluding from lightweight builds. Tests are now passing with any combination of feature flags. The flags historically haven't been tested by LLVM's build servers so caveat emptor. llvm-svn: 213171
* Track IntrusiveRefCntPtr::get() changes from LLVM r212366Alp Toker2014-07-051-2/+2
| | | | llvm-svn: 212369
* Remove 'const' from MemoryBuffers used through the SourceManagerDavid Blaikie2014-06-271-2/+1
| | | | | | | | | | | | | | This removes a const_cast added in r211884 that occurred due to an inconsistency in how MemoryBuffers are handled between some parts of clang and LLVM. MemoryBuffers are immutable and the general convention in the LLVM project is to omit const from immutable types as it's simply redundant/verbose (see llvm::Type, for example). While this change doesn't remove "const" from /every/ MemoryBuffer, it at least makes this chain of ownership/usage consistent. llvm-svn: 211915
* Make test from r211758 portableAlp Toker2014-06-261-0/+1
| | | | | | | It turns out the -fblocks option is determined by the default tooling target and not implied by the other two flags. llvm-svn: 211761
* RAV: visit copy expressions of captured variables in blocks (ObjC++11)Alp Toker2014-06-262-1/+22
| | | | | | Patch by Mathieu Baudet. llvm-svn: 211758
* Replace llvm::error_code with std::error_code.Rafael Espindola2014-06-122-5/+3
| | | | llvm-svn: 210780
* [C++11] Use 'nullptr'. Unittests edition.Craig Topper2014-06-085-12/+12
| | | | llvm-svn: 210423
* Fix RecursiveASTVisitor to visit types in ObjCPropertyDeclAlp Toker2014-06-062-1/+11
| | | | | | Patch by Mathieu Baudet! llvm-svn: 210339
* 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
* [modules] Fix ODR violation: there's another clang::TypeLocVisitor elsewhere.Richard Smith2014-05-191-3/+4
| | | | llvm-svn: 209169
* 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 two leaks found by LSan (one is test-only).Nico Weber2014-04-241-1/+1
| | | | | | | The result of llvm::MemoryBuffer::getMemBuffer() needs to be freed. Don't pass "don't free" flag to overrideFileContents() to fix. llvm-svn: 207075
* Fix two test-only leaks found by LSan.Nico Weber2014-04-242-2/+6
| | | | | | | | | The result of getBufferForFile() must be freed. (Should we change functions that expect the caller to assume ownership so that they return unique_ptrs instead? Then the type system makes sure we get this right.) llvm-svn: 207074
* 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-073-15/+15
| | | | | | This compiles cleanly with lldb/lld/clang-tools-extra/llvm. llvm-svn: 203279
* Replace OwningPtr::isValid() with conversion to bool.Ahmed Charles2014-03-071-4/+4
| | | | | | This is a precursor to moving to std::unique_ptr. llvm-svn: 203277
* 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
* unittests: explicit stringify StringRefs for conversionSaleem Abdulrasool2014-01-251-1/+1
| | | | | | | | | When clang is built outside of the LLVM tree (against a corresponding version), there is no definition providing for operator<<(std::ostream &, StringRef) which is required for the assertion routines in google-test tests. Avoid the compilation failure by explicitly stringifying the StringRef prior to use. llvm-svn: 200096
* Sort all the #include lines with LLVM's utils/sort_includes.py whichChandler Carruth2014-01-072-2/+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
* Update RecursiveASTVisitor so that it visits attributes. This is currentlyDeLesley Hutchins2013-12-301-0/+39
| | | | | | | | important for thread safety attributes, which contain expressions that were not being visited, and were thus invisible to various tools. There are now Visit*Attr methods that can be overridden for every attribute. llvm-svn: 198224
* [CMake] Update target_link_libraries() and LLVM_LINK_COMPONENTS for each ↵NAKAMURA Takumi2013-12-101-6/+6
| | | | | | CMakeLists.txt. llvm-svn: 196916
* Relax some preconditions for using FixedCompilationDatabase.Edwin Vane2013-11-171-3/+41
| | | | | | | | FixedCompilationDatabase (FCD) requires that the arguments it consumes after '--' must not include positional parameters or the argv[0] of the tool. This patch relaxes those restrictions. llvm-svn: 194968
* 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
OpenPOWER on IntegriCloud