summaryrefslogtreecommitdiffstats
path: root/clang/lib/Tooling/CommonOptionsParser.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [Clang] Migrate llvm::make_unique to std::make_uniqueJonas Devlieghere2019-08-141-1/+1
| | | | | | | | | | 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
* Fixed two issues in clang-tidy -help.Alexander Kornienko2019-07-011-1/+1
| | | | | | HeaderFilter -> HeaderFilterRegex llvm-svn: 364837
* [CommandLineParser] Add DefaultOption flagDon Hinton2019-04-151-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: Add DefaultOption flag to CommandLineParser which provides a default option or alias, but allows users to override it for some other purpose as needed. Also, add `-h` as a default alias to `-help`, which can be seamlessly overridden by applications like llvm-objdump and llvm-readobj which use `-h` as an alias for other options. (relanding after revert, r358414) Added DefaultOptions.clear() to reset(). Reviewers: alexfh, klimek Reviewed By: klimek Subscribers: kristina, MaskRay, mehdi_amini, inglorion, dexonsmith, hiraditya, llvm-commits, jhenderson, arphaman, cfe-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D59746 llvm-svn: 358428
* Revert r358337: "[CommandLineParser] Add DefaultOption flag"Ilya Biryukov2019-04-151-0/+2
| | | | | | | The change causes test failures under asan. Reverting to unbreak our integrate. llvm-svn: 358414
* [CommandLineParser] Add DefaultOption flagDon Hinton2019-04-131-2/+0
| | | | | | | | | | | | | | | | | | | | | | Summary: Add DefaultOption flag to CommandLineParser which provides a default option or alias, but allows users to override it for some other purpose as needed. Also, add `-h` as a default alias to `-help`, which can be seamlessly overridden by applications like llvm-objdump and llvm-readobj which use `-h` as an alias for other options. Reviewers: alexfh, klimek Reviewed By: klimek Subscribers: MaskRay, mehdi_amini, inglorion, dexonsmith, hiraditya, llvm-commits, jhenderson, arphaman, cfe-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D59746 llvm-svn: 358337
* 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] A new framework for executing clang frontend actions.Eric Liu2017-10-261-3/+5
| | | | | | | | | | | | | | | | | | | | | | | Summary: This defines a `clang::tooling::ToolExecutor` interface that can be extended to support different execution plans including standalone execution on a given set of TUs or parallel execution on all TUs in a codebase. In order to enable multiprocessing execution, tool actions are expected to output result into a `ToolResults` interface provided by executors. The `ToolResults` interface abstracts how results are stored e.g. in-memory for standalone executions or on-disk for large-scale execution. New executors can be registered as `ToolExecutorPlugin`s via the `ToolExecutorPluginRegistry`. CLI tools can use `createExecutorFromCommandLineArgs` to create a specific registered executor according to the command-line arguments. This patch also implements `StandaloneToolExecutor` which has the same behavior as the current `ClangTool` interface, i.e. execute frontend actions on a given set of TUs. At this point, it's simply a wrapper around `ClangTool` at this point. This is still experimental but expected to replace the existing `ClangTool` interface so that specific tools would not need to worry about execution. Reviewers: klimek, arphaman, hokein, sammccall Reviewed By: klimek Subscribers: cfe-commits, djasper, mgorny, omtcyfz Differential Revision: https://reviews.llvm.org/D34272 llvm-svn: 316653
* [Tooling] Add a factory method for CommonOptionsParserEric Liu2017-10-241-6/+39
| | | | | | | | | | | | | | Summary: This returns error instead of exiting the program in case of error. Reviewers: klimek, hokein Reviewed By: hokein Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D39042 llvm-svn: 316433
* [refactor] Use CommonOptionsParser in clang-refactorAlex Lorenz2017-09-141-5/+7
| | | | | | | | | This commit ensures that CommonOptionsParser works with subcommands. This allows clang-refactor to use the CommonOptionsParser. Differential Revision: https://reviews.llvm.org/D37618 llvm-svn: 313260
* [CommonOptionsParser] Expose ArgumentsAdjustingCompilationDatabaseJohannes Altmanninger2017-08-181-34/+23
| | | | | | | This is useful for tools such as clang-diff which do not use CommonOptionsParser due to the need for multiple compilation databases. llvm-svn: 311170
* Method loadFromCommandLine should be able to report errorsSerge Pavlov2017-05-241-2/+5
| | | | | | | | | | | | | | | 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
* Apply some suggestions from clang-tidy's performance-unnecessary-value-param.Benjamin Kramer2016-06-151-1/+1
| | | | | | No functionality change intended. llvm-svn: 272789
* Print options, if requested.Alexander Kornienko2016-02-231-0/+2
| | | | llvm-svn: 261625
* Add fall-back mode for clang tools.Manuel Klimek2015-12-031-4/+7
| | | | | | | | | Run without flags if we cannot load a compilation database. This matches the behavior of clang itself when simply called with a source file. Based on a patch by Russell Wallace. llvm-svn: 254599
* 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
* [clang-tidy] Make NumOccurrenceFlag for SourcePaths configurable.Alexander Kornienko2015-08-171-4/+7
| | | | | | | | | | | | Added an additional ctor that takes a NumOccurrenceFlag parameter for the SourcePaths option. This frees applications from always having to pass at least one source file, e.g., -list-checks. http://reviews.llvm.org/D12069 Patch by Don Hinton! llvm-svn: 245204
* [tooling] Move ArgumentsAdjustingCompilations into an anonymous namespace.Benjamin Kramer2015-03-231-0/+2
| | | | | | NFC. llvm-svn: 232947
* Adopt new cl::HideUnrelatedOptions API added r226729.Chris Bieneman2015-01-211-9/+1
| | | | | | | | | | | | Summary: cl::HideUnrelatedOptions allows tools to hide all options not part of a specific OptionCategory. This is the common use case for cl::getRegisteredOptions, which should be deprecated in the future because it exposes implementation details of command line parsing. Reviewers: dexonsmith Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D7109 llvm-svn: 226741
* Make ArgumentsAdjuster an std::function.Alexander Kornienko2014-12-031-8/+6
| | | | | | | | | | | | Reviewers: klimek Reviewed By: klimek Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D6505 llvm-svn: 223248
* [clang-tidy] Move -extra-arg handling to CommonOptionsProviderAlexander Kornienko2014-11-041-0/+57
| | | | | | | | | | | | | | | | | | Summary: Handle -extra-arg and -extra-arg-before options in the CommonOptionsProvider so they can be used in all clang tools. Adjust arguments in a CompilationDatabase wrapper instead of adding ArgumentsAdjuster to the tool. Reviewers: djasper, klimek Reviewed By: klimek Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D6073 llvm-svn: 221248
* CompilationDatabase: Sure-up ownership of compilation databases using ↵David Blaikie2014-08-081-4/+4
| | | | | | | | | | | | | std::unique_ptr Diving into the memory leaks fixed by r213851 there was one case of a memory leak of a CompilationDatabase due to not properly taking ownership of the result of "CompilationDatabase::autoDetectFromSource". Given that both implementations and callers have been using unique_ptr to own CompilationDatabase objects - make this explicit in the API to reduce the risk of further leaks. llvm-svn: 215215
* Filter-out irrelevant command-line options in CommonOptionsParser.Alexander Kornienko2013-12-121-3/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Leave only -help, -version and options from the specified category. Updated clang-check and clang-tidy. As clang-tidy is in a separate repository, here's the diff: Index: tools/extra/clang-tidy/tool/ClangTidyMain.cpp =================================================================== --- tools/extra/clang-tidy/tool/ClangTidyMain.cpp (revision 197024) +++ tools/extra/clang-tidy/tool/ClangTidyMain.cpp (working copy) @@ -39,7 +39,7 @@ // FIXME: Add option to list name/description of all checks. int main(int argc, const char **argv) { - CommonOptionsParser OptionsParser(argc, argv); + CommonOptionsParser OptionsParser(argc, argv, ClangTidyCategory); SmallVector<clang::tidy::ClangTidyError, 16> Errors; clang::tidy::runClangTidy(Checks, OptionsParser.getCompilations(), Reviewers: djasper, klimek Reviewed By: djasper CC: cfe-commits, revane, klimek Differential Revision: http://llvm-reviews.chandlerc.com/D2379 llvm-svn: 197139
* Allow clang tools to display an overview when using the CommonOptionsParser.Manuel Klimek2013-07-191-2/+3
| | | | | | Patch by Guillaume Papin. llvm-svn: 186671
* Style and Doc fix for CommonOptionsParserEdwin Vane2012-12-141-2/+2
| | | | | | | | | | | | - Renaming GetCompilations() and GetSourcePathList() to follow LLVM style. - Updating docs to reflect name change. - Also updating help text to not mention clang-check since this class can be used by any tool. Reviewed By: Alexander Kornienko llvm-svn: 170229
* Only add common tool options when CommonOptionsParser is used.Alexander Kornienko2012-08-281-5/+5
| | | | | | | | | | | | | | Summary: Subj. Reviewers: chandlerc, klimek, djasper Reviewed By: klimek CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D29 llvm-svn: 162798
* Updated LibTooling.html, minor improvements in CommonOptionsParserAlexander Kornienko2012-08-241-1/+1
| | | | llvm-svn: 162521
* Reverted clang-check to fully supported CommandLine Library use-case: globalAlexander Kornienko2012-08-221-0/+79
static variables. llvm-svn: 162391
OpenPOWER on IntegriCloud