[llvm-commits] CVS: llvm/lib/Support/CommandLine.cpp

Chris Lattner lattner at cs.uiuc.edu
Thu May 22 15:27:01 PDT 2003


Changes in directory llvm/lib/Support:

CommandLine.cpp updated: 1.28 -> 1.29

---
Log message:

Add new CommaSeparated option modifier


---
Diffs of the changes:

Index: llvm/lib/Support/CommandLine.cpp
diff -u llvm/lib/Support/CommandLine.cpp:1.28 llvm/lib/Support/CommandLine.cpp:1.29
--- llvm/lib/Support/CommandLine.cpp:1.28	Thu May 22 15:06:43 2003
+++ llvm/lib/Support/CommandLine.cpp	Thu May 22 15:26:17 2003
@@ -318,6 +318,26 @@
       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);
   }
 





More information about the llvm-commits mailing list