summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Tooling/CompilationDatabaseTest.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [Tooling] Add operator== to CompileCommandSimon Marchi2018-07-171-0/+28
| | | | | | | | | | | | Summary: It does the obvious thing of comparing all fields. This will be needed for a clangd patch I have in the pipeline. Subscribers: dblaikie, ilya-biryukov, ioeric, cfe-commits Differential Revision: https://reviews.llvm.org/D49265 llvm-svn: 337284
* [Tooling] Correct the "-std" compile command option.Haojian Wu2018-04-111-2/+2
| | | | | | | | | | | | | | | Summary: "-std c++11" is not valid in compiler, we have to use "-std=c++11". Test in vscode with this patch, code completion for header works as expected. Reviewers: sammccall Subscribers: cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D45512 llvm-svn: 329786
* [Tooling] A CompilationDatabase wrapper that infers header commands.Sam McCall2018-04-091-0/+110
| | | | | | | | | | | | Summary: The wrapper finds the closest matching compile command using filename heuristics and makes minimal tweaks so it can be used with the header. Subscribers: klimek, mgorny, cfe-commits Differential Revision: https://reviews.llvm.org/D45006 llvm-svn: 329580
* [Tooling] FixedCompilationDatabase should be able to strip positionalAlex Lorenz2017-06-291-0/+21
| | | | | | | | | | | | | arguments when `-fsyntax-only` is used Previously, Clang failed to create a fixed compilation database when the compilation arguments use -fsyntax-only instead of -c. This commit fixes the issue by forcing Clang to look at the compilation job when stripping the positional arguments. Differential Revision: https://reviews.llvm.org/D34687 llvm-svn: 306659
* Method loadFromCommandLine should be able to report errorsSerge Pavlov2017-05-241-10/+22
| | | | | | | | | | | | | | | Now FixedCompilationDatabase::loadFromCommandLine has no means to report which error occurred if it fails to create compilation object. This is a block for implementing D33013, because after that change driver will refuse to create compilation if command line contains erroneous options. This change adds additional argument to loadFromCommandLine, which is assigned error message text if compilation object was not created. This is the same way as other methods of CompilationDatabase report failure. Differential Revision: https://reviews.llvm.org/D33272 llvm-svn: 303741
* Revert r301487: Replace HashString algorithm with xxHash64Rui Ueyama2017-04-261-2/+2
| | | | | | This reverts commit r301487 to make buildbots green. llvm-svn: 301491
* Replace HashString algorithm with xxHash64Rui Ueyama2017-04-261-2/+2
| | | | | | | | | | | | The previous algorithm processed one character at a time, which is very painful on a modern CPU. Replace it with xxHash64, which both already exists in the codebase and is fairly fast. Patch from Scott Smith! Differential Revision: https://reviews.llvm.org/D32509 llvm-svn: 301487
* Extend CompilationDatabase by a field for the output filenameJoerg Sonnenberger2016-12-011-1/+7
| | | | | | | | | | | | | | In bigger projects like an Operating System, the same source code is often compiled in slightly different ways. This could be the difference between PIC and non-PIC code for static vs dynamic libraries, it could also be the difference between size optimised versions of tools for ramdisk images. At the moment, the compilation database has no way to distinguish such cases. As first step, add a field in the JSON format for it and process it accordingly. Differential Revision: https://reviews.llvm.org/D27138 llvm-svn: 288436
* Resubmit "[Tooling] Parse compilation database command lines on Windows."Zachary Turner2016-08-181-32/+50
| | | | | | | | | | | | | | | | | | This patch introduced the ability to decide at runtime whether to parse JSON compilation database command lines using Gnu syntax or Windows syntax. However, there were many existing unit tests written that hardcoded Gnu-specific paths. These tests were now failing because the auto-detection logic was choosing to parse them using Windows rules. This resubmission of the patch fixes this by introducing an enum which defines the syntax mode, which defaults to auto-detect, but for which the unit tests force Gnu style parsing. Reviewed By: alexfh Differential Revision: https://reviews.llvm.org/D23628 llvm-svn: 279120
* [NFC] Header cleanupMehdi Amini2016-07-181-1/+0
| | | | | | | | | | 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
* Roll-back r250822.Angel Garcia Gomez2015-10-201-1/+1
| | | | | | | | | | 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-1/+1
| | | | | | | | | | | | 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
* [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
* [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
* Use 'override/final' instead of 'virtual' for overridden methodsAlexander Kornienko2015-04-111-2/+2
| | | | | | | | | | | | | | | | | | | | 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
* [C++11] Use 'nullptr'. Unittests edition.Craig Topper2014-06-081-3/+3
| | | | llvm-svn: 210423
* Replace OwningPtr with std::unique_ptr.Ahmed Charles2014-03-071-9/+9
| | | | | | 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
* 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
* 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
* Include Path.h instead of PathV2.h.Rafael Espindola2013-06-111-1/+1
| | | | | | I am about to move PathV2.h to Path.h. llvm-svn: 183795
* Use only explicit bool conversion operatorDavid Blaikie2013-05-151-2/+2
| | | | | | | | | | | | | | | | | | | The most common (non-buggy) case are where such objects are used as return expressions in bool-returning functions or as boolean function arguments. In those cases I've used (& added if necessary) a named function to provide the equivalent (or sometimes negative, depending on convenient wording) test. DiagnosticBuilder kept its implicit conversion operator owing to the prevalent use of it in return statements. One bug was found in ExprConstant.cpp involving a comparison of two PointerUnions (PointerUnion did not previously have an operator==, so instead both operands were converted to bool & then compared). A test is included in test/SemaCXX/constant-expression-cxx1y.cpp for the fix (adding operator== to PointerUnion in LLVM). llvm-svn: 181869
* CommandLineArgumentParser: handle single quotes.Peter Collingbourne2013-03-021-0/+6
| | | | | | Differential Revision: http://llvm-reviews.chandlerc.com/D482 llvm-svn: 176404
* Remove useless 'llvm::' qualifier from names like StringRef and others that areDmitri Gribenko2013-01-121-7/+7
| | | | | | brought into 'clang' namespace by clang/Basic/LLVM.h llvm-svn: 172323
* Introduce CompilationDatabase::getAllCompileCommands() that returns allArgyrios Kyrtzidis2012-12-041-0/+49
| | | | | | compile commands of the database and expose it via the libclang API. llvm-svn: 169226
* CompilationDatabaseTest: Fix another Windows path issue.Daniel Jasper2012-10-081-2/+6
| | | | llvm-svn: 165425
* CompilationDatabase: Use //net paths for tests, as they should beDaniel Jasper2012-10-081-40/+42
| | | | | | considered absolute on all platforms. llvm-svn: 165422
* FileNameMatchTrie: Use StringRef instead of Twines where possible.Daniel Jasper2012-10-081-2/+2
| | | | llvm-svn: 165412
* Support symlinks and relative paths in complilation databases.Daniel Jasper2012-10-081-9/+86
| | | | | Review: http://llvm-reviews.chandlerc.com/D30 llvm-svn: 165392
* Use LLVM's plugin registry to enable registering new compilationDaniel Jasper2012-08-241-1/+1
| | | | | | | databases. Move JSONCompilationDatabase.h to its own files and register it as plugin. llvm-svn: 162541
* Allows retrieving all files in a CompilationDatabase.Manuel Klimek2012-07-131-0/+38
| | | | | | Patch by Tobias Koenig, some test changes by myself. llvm-svn: 160167
* Fixes crasher bug in JSONCompilationDatabase for invalid input.Manuel Klimek2012-05-151-0/+20
| | | | llvm-svn: 156814
* Adds a FixedCompilationDatabase to be able to specify tool parametersManuel Klimek2012-04-181-0/+69
| | | | | | at the command line. llvm-svn: 154989
* Adds a tooling library.Manuel Klimek2012-04-041-0/+223
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
OpenPOWER on IntegriCloud