summaryrefslogtreecommitdiffstats
path: root/llvm/support/lib/Support/CommandLine.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-05-22 20:26:17 +0000
committerChris Lattner <sabre@nondot.org>2003-05-22 20:26:17 +0000
commit929f27a3e63fffb4e48755f05943af7deed41b9e (patch)
tree75193104bdf521cfd80eb505f5f6564ce29f36d4 /llvm/support/lib/Support/CommandLine.cpp
parent5eb85148bd656a0be3922475c9cfbacf475e8126 (diff)
downloadbcm5719-llvm-929f27a3e63fffb4e48755f05943af7deed41b9e.tar.gz
bcm5719-llvm-929f27a3e63fffb4e48755f05943af7deed41b9e.zip
Add new CommaSeparated option modifier
llvm-svn: 6294
Diffstat (limited to 'llvm/support/lib/Support/CommandLine.cpp')
-rw-r--r--llvm/support/lib/Support/CommandLine.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/llvm/support/lib/Support/CommandLine.cpp b/llvm/support/lib/Support/CommandLine.cpp
index a46c68c986e..a0eca7a8ed4 100644
--- a/llvm/support/lib/Support/CommandLine.cpp
+++ b/llvm/support/lib/Support/CommandLine.cpp
@@ -318,6 +318,26 @@ void cl::ParseCommandLineOptions(int &argc, char **argv,
continue;
}
+ // Check to see if this option accepts a comma separated list of values. If
+ // it does, we have to split up the value into multiple values...
+ if (Handler->getMiscFlags() & CommaSeparated) {
+ std::string Val(Value);
+ std::string::size_type Pos = Val.find(',');
+
+ while (Pos != std::string::npos) {
+ // Process the portion before the comma...
+ ErrorParsing |= ProvideOption(Handler, ArgName,
+ std::string(Val.begin(),
+ Val.begin()+Pos).c_str(),
+ argc, argv, i);
+ // Erase the portion before the comma, AND the comma...
+ Val.erase(Val.begin(), Val.begin()+Pos+1);
+ Value += Pos+1; // Increment the original value pointer as well...
+
+ // Check for another comma...
+ Pos = Val.find(',');
+ }
+ }
ErrorParsing |= ProvideOption(Handler, ArgName, Value, argc, argv, i);
}
OpenPOWER on IntegriCloud