#
d97d5a2c |
| 13-Sep-2016 |
Zachary Turner <zturner@google.com> |
Revert "[Support][CommandLine] Add cl::getRegisteredSubcommands()"
This reverts r281290, as it breaks unit tests. http://lab.llvm.org:8011/builders/clang-x86-windows-msvc2015/builds/303
llvm-svn: 2
Revert "[Support][CommandLine] Add cl::getRegisteredSubcommands()"
This reverts r281290, as it breaks unit tests. http://lab.llvm.org:8011/builders/clang-x86-windows-msvc2015/builds/303
llvm-svn: 281292
show more ...
|
#
d9d290c0 |
| 13-Sep-2016 |
Dean Michael Berris <dberris@google.com> |
[Support][CommandLine] Add cl::getRegisteredSubcommands()
This should allow users of the library to get a range to iterate through all the subcommands that are registered to the global parser. This
[Support][CommandLine] Add cl::getRegisteredSubcommands()
This should allow users of the library to get a range to iterate through all the subcommands that are registered to the global parser. This allows users to define subcommands in libraries that self-register to have dispatch done at a different stage (like main). It allows for writing code like the following:
for (auto *S : cl::getRegisteredSubcommands()) { if (*S) { // Dispatch on S->getName(). } }
This change also contains tests that show this usage pattern.
Reviewers: zturner, dblaikie, echristo
Subscribers: llvm-commits, mehdi_amini
Differential Revision: https://reviews.llvm.org/D24489
llvm-svn: 281290
show more ...
|
Revision tags: llvmorg-3.9.0, llvmorg-3.9.0-rc3, llvmorg-3.9.0-rc2, llvmorg-3.9.0-rc1 |
|
#
07670b3e |
| 29-Jun-2016 |
Zachary Turner <zturner@google.com> |
Resubmit "Update llvm command line parser to support subcommands."
This fixes an issue where occurrence counts would be unexpectedly reset when parsing different parts of a command line multiple tim
Resubmit "Update llvm command line parser to support subcommands."
This fixes an issue where occurrence counts would be unexpectedly reset when parsing different parts of a command line multiple times.
**ORIGINAL COMMIT MESSAGE**
This allows command line tools to use syntaxes like the following:
llvm-foo.exe command1 -o1 -o2 llvm-foo.exe command2 -p1 -p2
Where command1 and command2 contain completely different sets of valid options. This is backwards compatible with previous uses of llvm cl which did not support subcommands, as any option which specifies no optional subcommand (e.g. all existing code) goes into a special "top level" subcommand that expects dashed options to appear immediately after the program name. For example, code which is subcommand unaware would generate a command line such as the following, where no subcommand is specified:
llvm-foo.exe -q1 -q2
The top level subcommand can co-exist with actual subcommands, as it is implemented as an actual subcommand which is searched if no explicit subcommand is specified. So llvm-foo.exe as specified above could be written so as to support all three aforementioned command lines simultaneously.
There is one additional "special" subcommand called AllSubCommands, which can be used to inject an option into every subcommand. This is useful to support things like help, so that commands such as:
llvm-foo.exe --help llvm-foo.exe command1 --help llvm-foo.exe command2 --help
All work and display the help for the selected subcommand without having to explicitly go and write code to handle each one separately.
This patch is submitted without an example of anything actually using subcommands, but a followup patch will convert the llvm-pdbdump tool to use subcommands.
Reviewed By: beanz
llvm-svn: 274171
show more ...
|
#
d16490df |
| 28-Jun-2016 |
Manman Ren <manman.ren@gmail.com> |
Revert r274054 to try to appease the bot
llvm-svn: 274072
|
#
2012d744 |
| 28-Jun-2016 |
Zachary Turner <zturner@google.com> |
Update llvm command line parser to support subcommands.
This allows command line tools to use syntaxes like the following:
llvm-foo.exe command1 -o1 -o2 llvm-foo.exe command2 -p1 -p2
Where com
Update llvm command line parser to support subcommands.
This allows command line tools to use syntaxes like the following:
llvm-foo.exe command1 -o1 -o2 llvm-foo.exe command2 -p1 -p2
Where command1 and command2 contain completely different sets of valid options. This is backwards compatible with previous uses of llvm cl which did not support subcommands, as any option which specifies no optional subcommand (e.g. all existing code) goes into a special "top level" subcommand that expects dashed options to appear immediately after the program name. For example, code which is subcommand unaware would generate a command line such as the following, where no subcommand is specified:
llvm-foo.exe -q1 -q2
The top level subcommand can co-exist with actual subcommands, as it is implemented as an actual subcommand which is searched if no explicit subcommand is specified. So llvm-foo.exe as specified above could be written so as to support all three aforementioned command lines simultaneously.
There is one additional "special" subcommand called AllSubCommands, which can be used to inject an option into every subcommand. This is useful to support things like help, so that commands such as:
llvm-foo.exe --help llvm-foo.exe command1 --help llvm-foo.exe command2 --help
All work and display the help for the selected subcommand without having to explicitly go and write code to handle each one separately.
This patch is submitted without an example of anything actually using subcommands, but a followup patch will convert the llvm-pdbdump tool to use subcommands.
Reviewed By: beanz Differential Revision: http://reviews.llvm.org/D21485
llvm-svn: 274054
show more ...
|
Revision tags: llvmorg-3.8.1, llvmorg-3.8.1-rc1 |
|
#
fa7f4898 |
| 26-Apr-2016 |
Nico Weber <nicolasweber@gmx.de> |
Use gcc's rules for parsing gcc-style response files
In gcc, \ escapes every character in response files. It is true that this makes it harder to mention Windows files in rsp files, but not doing th
Use gcc's rules for parsing gcc-style response files
In gcc, \ escapes every character in response files. It is true that this makes it harder to mention Windows files in rsp files, but not doing this means clang disagrees with gcc, and also disagrees with the shell (on non-Windows) which rsp file quoting is supposed to match. clang isn't free to choose what to do here.
In general, the idea for response files is to take bits of your command line and write them to a file unchanged, and have things work the same way. Since the command line would've been interpreted by the shell, things in the rsp file need to be subject to the same shell quoting rules.
People who want to put Windows-style paths in their response files either need to do any of: * escape their backslashes * or use clang-cl which uses cl.exe/cmd.exe quoting rules * pass --rsp-quoting=windows to clang to tell it to use cl.exe/cmd.exe quoting rules for response files.
Fixes PR27464. http://reviews.llvm.org/D19417
llvm-svn: 267556
show more ...
|
#
91d3cfed |
| 05-Apr-2016 |
Duncan P. N. Exon Smith <dexonsmith@apple.com> |
Revert "Fix Clang-tidy modernize-deprecated-headers warnings in remaining files; other minor fixes."
This reverts commit r265454 since it broke the build. E.g.:
http://lab.llvm.org:8080/green/jo
Revert "Fix Clang-tidy modernize-deprecated-headers warnings in remaining files; other minor fixes."
This reverts commit r265454 since it broke the build. E.g.:
http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-incremental_build/22413/
llvm-svn: 265459
show more ...
|
#
1760dc2a |
| 05-Apr-2016 |
Eugene Zelenko <eugene.zelenko@gmail.com> |
Fix Clang-tidy modernize-deprecated-headers warnings in remaining files; other minor fixes.
Some Include What You Use suggestions were used too.
Use anonymous namespaces in source files.
Different
Fix Clang-tidy modernize-deprecated-headers warnings in remaining files; other minor fixes.
Some Include What You Use suggestions were used too.
Use anonymous namespaces in source files.
Differential revision: http://reviews.llvm.org/D18778
llvm-svn: 265454
show more ...
|
Revision tags: llvmorg-3.8.0, llvmorg-3.8.0-rc3, llvmorg-3.8.0-rc2, llvmorg-3.8.0-rc1, llvmorg-3.7.1, llvmorg-3.7.1-rc2 |
|
#
ff43d69d |
| 17-Nov-2015 |
David Blaikie <dblaikie@gmail.com> |
StringRef-ify some Option APIs
Patch by Eugene Kosov!
Differential Revision: http://reviews.llvm.org/D14711
llvm-svn: 253360
|
Revision tags: llvmorg-3.7.1-rc1, llvmorg-3.7.0, llvmorg-3.7.0-rc4, llvmorg-3.7.0-rc3, studio-1.4 |
|
#
b82455d2 |
| 13-Aug-2015 |
Rafael Espindola <rafael.espindola@gmail.com> |
There is only one saver of strings.
llvm-svn: 244854
|
Revision tags: llvmorg-3.7.0-rc2, llvmorg-3.7.0-rc1, llvmorg-3.6.2, llvmorg-3.6.2-rc1 |
|
#
454adf64 |
| 13-Jun-2015 |
Rafael Espindola <rafael.espindola@gmail.com> |
Bring in a BumpPtrStringSaver from lld and simplify the interface.
StringSaver now always saves to a BumpPtrAllocator.
The only reason for having the virtual saveImpl is so lld can have a thread sa
Bring in a BumpPtrStringSaver from lld and simplify the interface.
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
show more ...
|
Revision tags: llvmorg-3.6.1, llvmorg-3.6.1-rc1 |
|
#
f817c1cb |
| 11-Apr-2015 |
Alexander Kornienko <alexfh@google.com> |
Use 'override/final' instead of 'virtual' for overridden methods
The patch is generated using clang-tidy misc-use-override check.
This command was used:
tools/clang/tools/extra/clang-tidy/tool/r
Use 'override/final' instead of 'virtual' for overridden methods
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 -format
http://reviews.llvm.org/D8925
llvm-svn: 234679
show more ...
|
Revision tags: llvmorg-3.5.2, llvmorg-3.5.2-rc1 |
|
#
542a4543 |
| 26-Feb-2015 |
Reid Kleckner <reid@kleckner.net> |
Silence some Win64 clang-cl warnings about unused stuff due to ifdefs
llvm-svn: 230685
|
Revision tags: llvmorg-3.6.0, llvmorg-3.6.0-rc4, llvmorg-3.6.0-rc3, llvmorg-3.6.0-rc2 |
|
#
d1d9430a |
| 28-Jan-2015 |
Chris Bieneman <beanz@apple.com> |
Refactoring llvm command line parsing and option registration.
Summary: The primary goal of this patch is to remove the need for MarkOptionsChanged(). That goal is accomplished by having addOption a
Refactoring llvm command line parsing and option registration.
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
show more ...
|
#
68169362 |
| 27-Jan-2015 |
Chris Bieneman <beanz@apple.com> |
Re-landing changes to use ArrayRef instead of SmallVectorImpl, and new API test.
This contains the changes from r227148 & r227154, and also fixes to the test case to properly clean up the stack opti
Re-landing changes to use ArrayRef instead of SmallVectorImpl, and new API test.
This contains the changes from r227148 & r227154, and also fixes to the test case to properly clean up the stack options.
llvm-svn: 227255
show more ...
|
#
15ac9363 |
| 27-Jan-2015 |
Richard Trieu <rtrieu@google.com> |
Revert r227148 & r227154 which added a test which infinitely loops.
r227148 added test CommandLineTest.HideUnrelatedOptionsMulti which repeatedly outputs two following lines:
-tool: CommandLine Err
Revert r227148 & r227154 which added a test which infinitely loops.
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
show more ...
|
#
fd3dbd94 |
| 27-Jan-2015 |
Chris Bieneman <beanz@apple.com> |
One more fix to the new API to fix const-correctness.
llvm-svn: 227154
|
#
c333e577 |
| 26-Jan-2015 |
Chris Bieneman <beanz@apple.com> |
Pete Cooper suggested the new API should use ArrayRef instead of SmallVectorImpl. Also adding a test case.
llvm-svn: 227148
|
#
831fc5e8 |
| 26-Jan-2015 |
Chris Bieneman <beanz@apple.com> |
Putting all the standard tool options into a "Generic" category.
Summary: This puts all the options that CommandLine.cpp implements into a category so that the APIs to hide options can not hide base
Putting all the standard tool options into a "Generic" category.
Summary: This puts all the options that CommandLine.cpp implements into a category so that the APIs to hide options can not hide based on the generic category instead of string matching a partial list of argument strings.
This patch is pretty simple and straight forward but it does impact the -help output of all tools using cl::opt. Specifically the options implemented in CommandLine.cpp (help, help-list, help-hidden, help-list-hidden, print-options, print-all-options, version) are all grouped together into an Option category, and these options are never hidden by the cl::HideUnrelatedOptions API.
Reviewers: dexonsmith, chandlerc, majnemer
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D7150
llvm-svn: 227093
show more ...
|
#
9e13af7a |
| 21-Jan-2015 |
Chris Bieneman <beanz@apple.com> |
Adding a new cl::HideUnrelatedOptions API to allow clang to migrate off cl::getRegisteredOptions.
Summary: cl::getRegisteredOptions really exposes some of the innards of how command line parsing is
Adding a new cl::HideUnrelatedOptions API to allow clang to migrate off 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
show more ...
|
Revision tags: llvmorg-3.6.0-rc1, llvmorg-3.5.1, llvmorg-3.5.1-rc2, llvmorg-3.5.1-rc1, llvmorg-3.5.0, llvmorg-3.5.0-rc4 |
|
#
e3f146d9 |
| 22-Aug-2014 |
Reid Kleckner <reid@kleckner.net> |
Fix PR17239 by changing the semantics of the RemainingArgsClass Option kind
This patch contains the LLVM side of the fix of PR17239.
This bug that happens because the /link (clang-cl.exe argument)
Fix PR17239 by changing the semantics of the RemainingArgsClass Option kind
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
show more ...
|
Revision tags: llvmorg-3.5.0-rc3 |
|
#
db794849 |
| 15-Aug-2014 |
Sean Silva <chisophugis@gmail.com> |
Revert "[Support] Promote cl::StringSaver to a separate utility"
This reverts commit r215784 / 3f8a26f6fe16cc76c98ab21db2c600bd7defbbaa.
LLD has 3 StringSaver's, one of which takes a lock when savi
Revert "[Support] Promote cl::StringSaver to a separate utility"
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
show more ...
|
#
42ec6fdf |
| 15-Aug-2014 |
Sean Silva <chisophugis@gmail.com> |
[Support] Promote cl::StringSaver to a separate utility
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
[Support] Promote cl::StringSaver to a separate utility
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
show more ...
|
Revision tags: llvmorg-3.5.0-rc2, llvmorg-3.5.0-rc1 |
|
#
759645ea |
| 14-Jul-2014 |
Justin Bogner <mail@justinbogner.com> |
Support: Fix option handling when using cl::Required with aliasopt
Until now, attempting to create an alias of a required option would complain if the user supplied the alias, because the required o
Support: Fix option handling when using cl::Required with aliasopt
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
show more ...
|
#
66f09ad0 |
| 08-Jun-2014 |
Craig Topper <craig.topper@gmail.com> |
[C++11] Use 'nullptr'.
llvm-svn: 210442
|