aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Tooling/CommonOptionsParser.cpp
AgeCommit message (Collapse)AuthorFilesLines
2017-05-24Method loadFromCommandLine should be able to report errorsSerge Pavlov1-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
2016-06-15Apply some suggestions from clang-tidy's performance-unnecessary-value-param.Benjamin Kramer1-1/+1
No functionality change intended. llvm-svn: 272789
2016-02-23Print options, if requested.Alexander Kornienko1-0/+2
llvm-svn: 261625
2015-12-03Add fall-back mode for clang tools.Manuel Klimek1-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
2015-11-05Make ArgumentAdjuster aware of the current file being processed.Alexander Kornienko1-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
2015-08-17[clang-tidy] Make NumOccurrenceFlag for SourcePaths configurable.Alexander Kornienko1-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
2015-03-23[tooling] Move ArgumentsAdjustingCompilations into an anonymous namespace.Benjamin Kramer1-0/+2
NFC. llvm-svn: 232947
2015-01-21Adopt new cl::HideUnrelatedOptions API added r226729.Chris Bieneman1-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
2014-12-03Make ArgumentsAdjuster an std::function.Alexander Kornienko1-8/+6
Reviewers: klimek Reviewed By: klimek Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D6505 llvm-svn: 223248
2014-11-04[clang-tidy] Move -extra-arg handling to CommonOptionsProviderAlexander Kornienko1-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
2014-08-08CompilationDatabase: Sure-up ownership of compilation databases using ↵David Blaikie1-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
2013-12-12Filter-out irrelevant command-line options in CommonOptionsParser.Alexander Kornienko1-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
2013-07-19Allow clang tools to display an overview when using the CommonOptionsParser.Manuel Klimek1-2/+3
Patch by Guillaume Papin. llvm-svn: 186671
2012-12-14Style and Doc fix for CommonOptionsParserEdwin Vane1-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
2012-08-28Only add common tool options when CommonOptionsParser is used.Alexander Kornienko1-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
2012-08-24Updated LibTooling.html, minor improvements in CommonOptionsParserAlexander Kornienko1-1/+1
llvm-svn: 162521
2012-08-22Reverted clang-check to fully supported CommandLine Library use-case: globalAlexander Kornienko1-0/+79
static variables. llvm-svn: 162391