summaryrefslogtreecommitdiffstats
path: root/llvm/include/llvm/Support/CommandLine.h
diff options
context:
space:
mode:
authorThomas Preud'homme <thomasp@graphcore.ai>2019-01-14 09:28:53 +0000
committerThomas Preud'homme <thomasp@graphcore.ai>2019-01-14 09:28:53 +0000
commitbc5e6ee87a08618c3202eb1cecddd24267e64701 (patch)
treed6f4a11189b1f68206ce2c0f397faa7715a7284b /llvm/include/llvm/Support/CommandLine.h
parent4b7e12f2cfc8ec1eb0ea537371b8d2f499426655 (diff)
downloadbcm5719-llvm-bc5e6ee87a08618c3202eb1cecddd24267e64701.tar.gz
bcm5719-llvm-bc5e6ee87a08618c3202eb1cecddd24267e64701.zip
Add support for prefix-only CLI options
Summary: Add support for options that always prefix their value, giving an error if the value is in the next argument or if the option is given a value assignment (ie. opt=val). This is the desired behavior for the -D option of FileCheck for instance. Copyright: - Linaro (changes in version 2 of revision D55940) - GraphCore (changes in later versions and introduced when creating D56549) Reviewers: jdenny Subscribers: llvm-commits, probinson, kristina, hiraditya, JonChesterfield Differential Revision: https://reviews.llvm.org/D56549 llvm-svn: 351038
Diffstat (limited to 'llvm/include/llvm/Support/CommandLine.h')
-rw-r--r--llvm/include/llvm/Support/CommandLine.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/include/llvm/Support/CommandLine.h b/llvm/include/llvm/Support/CommandLine.h
index cd3543c130e..a8ad89384d1 100644
--- a/llvm/include/llvm/Support/CommandLine.h
+++ b/llvm/include/llvm/Support/CommandLine.h
@@ -156,6 +156,9 @@ enum OptionHidden { // Control whether -help shows this option
// enabled, and used, the value for the flag comes from the suffix of the
// argument.
//
+// AlwaysPrefix - Only allow the behavior enabled by the Prefix flag and reject
+// the Option=Value form.
+//
// Grouping - With this option enabled, multiple letter options are allowed to
// bunch together with only a single hyphen for the whole group. This allows
// emulation of the behavior that ls uses for example: ls -la === ls -l -a
@@ -165,7 +168,8 @@ enum FormattingFlags {
NormalFormatting = 0x00, // Nothing special
Positional = 0x01, // Is a positional argument, no '-' required
Prefix = 0x02, // Can this option directly prefix its value?
- Grouping = 0x03 // Can this option group with other options?
+ AlwaysPrefix = 0x03, // Can this option only directly prefix its value?
+ Grouping = 0x04 // Can this option group with other options?
};
enum MiscFlags { // Miscellaneous flags to adjust argument
@@ -265,7 +269,7 @@ class Option {
// detail representing the non-value
unsigned Value : 2;
unsigned HiddenFlag : 2; // enum OptionHidden
- unsigned Formatting : 2; // enum FormattingFlags
+ unsigned Formatting : 3; // enum FormattingFlags
unsigned Misc : 3;
unsigned Position = 0; // Position of last occurrence of the option
unsigned AdditionalVals = 0; // Greater than 0 for multi-valued option.
OpenPOWER on IntegriCloud