summaryrefslogtreecommitdiffstats
path: root/llvm/include/llvm/Support/CommandLine.h
Commit message (Collapse)AuthorAgeFilesLines
* StringRef-ify some Option APIsDavid Blaikie2015-11-171-16/+13
| | | | | | | | Patch by Eugene Kosov! Differential Revision: http://reviews.llvm.org/D14711 llvm-svn: 253360
* Support, IR: silence -Wunused-parameterSaleem Abdulrasool2015-10-231-1/+1
| | | | | | If this is used outside of LLVM with -Werror, this would cause a failure. llvm-svn: 251094
* There is only one saver of strings.Rafael Espindola2015-08-131-1/+0
| | | | llvm-svn: 244854
* Remove macro guards for extern template instantiations.Benjamin Kramer2015-07-131-14/+14
| | | | | | | This is a C++11 feature that both GCC and MSVC have supported as ane extension long before C++11 was approved. llvm-svn: 242042
* Bring in a BumpPtrStringSaver from lld and simplify the interface.Rafael Espindola2015-06-131-10/+3
| | | | | | | | | | | | StringSaver now always saves to a BumpPtrAllocator. The only reason for having the virtual saveImpl is so lld can have a thread safe version. The reason for the distinct BumpPtrStringSaver class is to avoid the virtual destructor. llvm-svn: 239669
* Fixing broken bots after r238505.Chris Bieneman2015-05-281-0/+7
| | | | | | Need non-const iterator inserts too. These failures seem to be due to differences in the versions of libstdc++ on various operating systems. llvm-svn: 238516
* Fixing the polly build.Chris Bieneman2015-05-281-0/+5
| | | | | | I broke the polly build in r238505. This fixes the failure by adding non-const iterator erase methods to cl::list_storage. llvm-svn: 238509
* Re-landing "Refactoring cl::list_storage from "is a" to "has a" std::vector."Chris Bieneman2015-05-281-10/+55
| | | | | | | | Originally landed r238485 MSVC resolves identifiers differently from Clang and GCC, this resulted in build bot failures. This pach re-lands r238485 and fixes the build failures. llvm-svn: 238505
* Revert "Refactoring cl::list_storage from "is a" to "has a" std::vector."Chris Bieneman2015-05-281-52/+7
| | | | | | This reverts commit 117715ca0613d3db144241499401f2ec5398f1d5. llvm-svn: 238491
* Refactoring cl::list_storage from "is a" to "has a" std::vector.Chris Bieneman2015-05-281-7/+52
| | | | | | | | | | | | | | Summary: This isn't necessarily an ideal change, and I want to at least reduce the API surface area, but for the new API we really shouldn't be relying on cl::list being a std::vector. Reviewers: chandlerc Reviewed By: chandlerc Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D10093 llvm-svn: 238485
* Recommit r231221: "Devirtualize ~parser<T> by making it protected in base ↵David Blaikie2015-03-041-10/+16
| | | | | | | | | | classes and making derived classes final" Reverted in r231254 due to a self-hosting crash of Clang (see Clang PR22793). Workaround the crash by using {} instead of = default to define a dtor. llvm-svn: 231274
* Revert r231221, "Devirtualize ~parser<T> by making it protected in base ↵NAKAMURA Takumi2015-03-041-15/+10
| | | | | | | | classes and making derived classes final" It broke seflhosting. llvm-svn: 231254
* Devirtualize ~parser<T> by making it protected in base classes and making ↵David Blaikie2015-03-041-10/+15
| | | | | | | | | derived classes final These objects are never owned/destroyed polymorphically, so there's no need for a virtual dtor. llvm-svn: 231221
* Avoid copying parser objectsDavid Blaikie2015-03-041-2/+2
| | | | | | | Use of their copy members is deprecated since they have a user-declared dtor. llvm-svn: 231220
* Make OptionValue explicitly copyableDavid Blaikie2015-03-041-0/+8
| | | | | | | | | Since OptionValue (& its base classes) have user-declared dtors, use of the implicit copy ctor/assignment operator is deprecated in C++11. Provide them explicitly (defaulted) to avoid depending on this deprecated feature. llvm-svn: 231218
* Devirtualize OptionValue::~OptionValue in favor of protected in the base, ↵David Blaikie2015-03-041-5/+19
| | | | | | | | | | with final derived classes These objects are never polymorphically owned, so there's no need for virtual dtors - just make the dtor protected in the base classes, and make the derived classes final. llvm-svn: 231217
* Revert "Remove the explicit SDNodeIterator::operator= in favor of the ↵David Blaikie2015-03-031-26/+10
| | | | | | | | | | | implicit default" Accidentally committed a few more of these cleanup changes than intended. Still breaking these out & tidying them up. This reverts commit r231135. llvm-svn: 231136
* Remove the explicit SDNodeIterator::operator= in favor of the implicit defaultDavid Blaikie2015-03-031-10/+26
| | | | | | | | | | There doesn't seem to be any need to assert that iterator assignment is between iterators over the same node - if you want to reuse an iterator variable to iterate another node, that's perfectly acceptable. Just don't mix comparisons between iterators into disjoint sequences, as usual. llvm-svn: 231135
* Removing LLVM_DELETED_FUNCTION, as MSVC 2012 was the last reason for ↵Aaron Ballman2015-02-151-8/+8
| | | | | | requiring the macro. NFC; LLVM edition. llvm-svn: 229340
* CommandLine: Use variadic templates to simplify opt constructors.Benjamin Kramer2015-02-151-295/+20
| | | | llvm-svn: 229332
* Moving AddLiteralOption's declaration higher up in the header to make gcc happy.Chris Bieneman2015-01-281-9/+12
| | | | llvm-svn: 227348
* Refactoring llvm command line parsing and option registration.Chris Bieneman2015-01-281-16/+21
| | | | | | | | | | | | | | | | | | | | | Summary: The primary goal of this patch is to remove the need for MarkOptionsChanged(). That goal is accomplished by having addOption and removeOption properly sort the options. This patch puts the new add and remove functionality on a CommandLineParser class that is a placeholder. Some of the functionality in this class will need to be merged into the OptionRegistry, and other bits can hopefully be in a better abstraction. This patch also removes the RegisteredOptionList global, and the need for cl::Option objects to be linked list nodes. The changes in CommandLineTest.cpp are required because these changes shift when we validate that options are not duplicated. Before this change duplicate options were only found during certain cl API calls (like cl::ParseCommandLine). With this change duplicate options are found during option construction. Reviewers: dexonsmith, chandlerc, pete Reviewed By: pete Subscribers: pete, majnemer, llvm-commits Differential Revision: http://reviews.llvm.org/D7132 llvm-svn: 227345
* Re-landing changes to use ArrayRef instead of SmallVectorImpl, and new API test.Chris Bieneman2015-01-271-1/+2
| | | | | | This contains the changes from r227148 & r227154, and also fixes to the test case to properly clean up the stack options. llvm-svn: 227255
* Revert r227148 & r227154 which added a test which infinitely loops.Richard Trieu2015-01-271-2/+1
| | | | | | | | | | | | r227148 added test CommandLineTest.HideUnrelatedOptionsMulti which repeatedly outputs two following lines: -tool: CommandLine Error: Option 'test-option-1' registered more than once! -tool: CommandLine Error: Option 'test-option-2' registered more than once! r227154 depends on changes from r227148 llvm-svn: 227167
* One more fix to the new API to fix const-correctness.Chris Bieneman2015-01-271-1/+1
| | | | llvm-svn: 227154
* Pete Cooper suggested the new API should use ArrayRef instead of ↵Chris Bieneman2015-01-261-1/+2
| | | | | | SmallVectorImpl. Also adding a test case. llvm-svn: 227148
* Add new HideUnrelatedOptions API that takes a SmallVectorImpl.Chris Bieneman2015-01-261-0/+9
| | | | | | Need a new API for clang-modernize that allows specifying a list of option categories to remain visible. This will allow clang-modernize to move off getRegisteredOptions. llvm-svn: 227140
* Refactoring cl::parser construction and initialization.Chris Bieneman2015-01-221-41/+58
| | | | | | | | | | | | | | | Summary: Some parsers need references back to the option they are members of. This is used for handling the argument string as well as by the various pass name parsers for making pass names into flags. Making parsers that need to refer back to the option have a reference to the option eliminates some of the members of various parsers, and enables further code cleanup. Reviewers: dexonsmith Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D7131 llvm-svn: 226864
* Making deleted copy constructors and operators to be private for better ↵Chris Bieneman2015-01-221-16/+16
| | | | | | diagnostics when deleted is not available. llvm-svn: 226769
* Assigning and copying command line option objects shouldn't be allowed.Chris Bieneman2015-01-221-0/+16
| | | | | | | | | | | | | | | Summary: The default copy and assignment operators for these objects probably don't actually do what the clients intend, so they should be deleted. Places using the assignment operator to set the value of an option should cast to the option's data type first to call into the override for operator=. Places using the copy constructor just need to be changed to not copy (i.e. passing by const reference instead of value). Reviewers: dexonsmith, chandlerc Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D7114 llvm-svn: 226762
* Adding a new cl::HideUnrelatedOptions API to allow clang to migrate off ↵Chris Bieneman2015-01-211-0/+9
| | | | | | | | | | | | | | | | cl::getRegisteredOptions. Summary: cl::getRegisteredOptions really exposes some of the innards of how command line parsing is implemented. Exposing new APIs that allow us to disentangle client code from implementation details will allow us to make more extensive changes to command line parsing. Reviewers: chandlerc, dexonsmith, beanz Reviewed By: dexonsmith Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D7100 llvm-svn: 226729
* Running clang-format on CommandLine.h and CommandLine.cpp.Chris Bieneman2015-01-131-380/+433
| | | | | | No functional changes, I'm just going to be doing a lot of work in these files and it would be helpful if they had more current LLVM style. llvm-svn: 225817
* Rename END_WITH_NULL to LLVM_END_WITH_NULL and move to Compiler.hReid Kleckner2014-11-041-3/+3
| | | | | | | | | We shouldn't put this kind of attribute stuff in DataTypes.h. Leave the END_WITH_NULL name for now so I can update clang without making build spam. llvm-svn: 221215
* Fix PR17239 by changing the semantics of the RemainingArgsClass Option kindReid Kleckner2014-08-221-5/+19
| | | | | | | | | | | | | | | | | | | | | | | This patch contains the LLVM side of the fix of PR17239. This bug that happens because the /link (clang-cl.exe argument) is marked as "consume all remaining arguments". However, when inside a response file, /link should only consume all remaining arguments inside the response file where it is located, not the entire command line after expansion. My patch will change the semantics of the RemainingArgsClass kind to always consume only until the end of the response file when the option originally came from a response file. There are only two options in this class: dash dash (--) and /link. Reviewed By: rnk Differential Revision: http://reviews.llvm.org/D4899 Patch by Rafael Auler! llvm-svn: 216280
* Revert "[Support] Promote cl::StringSaver to a separate utility"Sean Silva2014-08-151-1/+9
| | | | | | | | | This reverts commit r215784 / 3f8a26f6fe16cc76c98ab21db2c600bd7defbbaa. LLD has 3 StringSaver's, one of which takes a lock when saving the string... Need to investigate more closely. llvm-svn: 215790
* [Support] Promote cl::StringSaver to a separate utilitySean Silva2014-08-151-9/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This class is generally useful. In breaking it out, the primary change is that it has been made non-virtual. It seems like being abstract led to there being 3 different (2 in llvm + 1 in clang) concrete implementations which disagreed about the ownership of the saved strings (see the manual call to free() in the unittest StrDupSaver; yes this is different from the CommandLine.cpp StrDupSaver which owns the stored strings; which is different from Clang's StringSetSaver which just holds a reference to a std::set<std::string> which owns the strings). I've identified 2 other places in the codebase that are open-coding this pattern: memcpy(Alloc.Allocate<char>(strlen(S)+1), S, strlen(S)+1) I'll be switching them over. They are * llvm::sys::Process::GetArgumentVector * The StringAllocator member of YAMLIO's Input class This also will allow simplifying Clang's driver.cpp quite a bit. Let me know if there are any other places that could benefit from StringSaver. I'm also thinking of adding a saveStringRef member for getting a stable StringRef. llvm-svn: 215784
* Support: Fix option handling when using cl::Required with aliasoptJustin Bogner2014-07-141-2/+6
| | | | | | | | | | | | | | | | Until now, attempting to create an alias of a required option would complain if the user supplied the alias, because the required option didn't have a value. Similarly, if you said the alias was required, then using the base option would complain that the alias wasn't supplied. Lastly, if you put required on both, *neither* option would work. By changning alias to overload addOccurrence and setting cl::Required on the original option, we can get this to behave in a more useful way. I've also added a test and updated a user that was getting this wrong. llvm-svn: 212986
* [C++11] More 'nullptr' conversion. In some cases just using a boolean check ↵Craig Topper2014-04-141-1/+1
| | | | | | instead of comparing to nullptr. llvm-svn: 206142
* [C++11] Replace some comparisons with 'nullptr' with simple boolean checks ↵Craig Topper2014-04-091-1/+1
| | | | | | to reduce verbosity. llvm-svn: 205829
* [C++11] Make use of 'nullptr' in the Support library.Craig Topper2014-04-071-13/+14
| | | | llvm-svn: 205697
* [C++11] Replace LLVM-style type traits with C++11 standard ones.Benjamin Kramer2014-03-071-3/+2
| | | | | | No functionality change. llvm-svn: 203242
* [C+11] Add 'override' keyword to methods in the support library.Craig Topper2014-03-041-51/+57
| | | | llvm-svn: 202791
* Switch all uses of LLVM_OVERRIDE to just use 'override' directly.Craig Topper2014-03-021-5/+5
| | | | llvm-svn: 202621
* Re-apply r200853, which should not crash after Clang plugins were converted ↵Alexander Kornienko2014-02-271-2/+2
| | | | | | to loadable modules in r201256. llvm-svn: 202404
* Avoid collisions with Objective-C++ keywordsTobias Grosser2014-02-191-6/+6
| | | | | | | | Change parameter names exposed in headers to avoid collisions with Objective-C++ keywords. Contributed-by: Graham Lee <graham@iamleeg.com> llvm-svn: 201727
* Revert "Fix an invalid check for duplicate option categories."Rafael Espindola2014-02-051-2/+2
| | | | | | | | This reverts commit r200853. It was causing clang/Analysis/checker-plugins.c to crash. llvm-svn: 200858
* Fix an invalid check for duplicate option categories.Alexander Kornienko2014-02-051-2/+2
| | | | | | | | | | | | | | | | | | | | Summary: The check performed in the comparator is invalid, as some STL implementations enforce strict weak ordering by calling the comparator with the same value. This check was also in a wrong place: the assertion would only fire when -help was used. The new check is performed each time the category is registered (we are not going to have thousands of them, so it's fine to do it in O(N^2)). Reviewers: jordan_rose Reviewed By: jordan_rose CC: cfe-commits, alexmc Differential Revision: http://llvm-reviews.chandlerc.com/D2699 llvm-svn: 200853
* [CommandLine] Aliases require an value if their target requires a value.Jordan Rose2014-01-291-0/+10
| | | | | | | | | This can still be overridden by explicitly setting a value requirement on the alias option, but by default it should be the same. PR18649 llvm-svn: 200407
* Re-sort all of the includes with ./utils/sort_includes.py so thatChandler Carruth2014-01-071-1/+1
| | | | | | | | | | subsequent changes are easier to review. About to fix some layering issues, and wanted to separate out the necessary churn. Also comment and sink the include of "Windows.h" in three .inc files to match the usage in Memory.inc. llvm-svn: 198685
* [weak vtables] Remove a bunch of weak vtablesJuergen Ributzka2013-11-191-0/+4
| | | | | | | | | | | | This patch removes most of the trivial cases of weak vtables by pinning them to a single object file. The memory leaks in this version have been fixed. Thanks Alexey for pointing them out. Differential Revision: http://llvm-reviews.chandlerc.com/D2068 Reviewed by Andy llvm-svn: 195064
OpenPOWER on IntegriCloud