NFC. More code cleanup making LookupOption a member of the CommandLineParser.
authorChris Bieneman <beanz@apple.com>
Fri, 13 Feb 2015 22:54:27 +0000 (22:54 +0000)
committerChris Bieneman <beanz@apple.com>
Fri, 13 Feb 2015 22:54:27 +0000 (22:54 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229170 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Support/CommandLine.cpp

index 7d9f3b7930a484229871f5fca87c42085d5234ce..9a1e8831064df7fcc601257c00f3a99568dee7f8 100644 (file)
@@ -190,6 +190,9 @@ public:
   }
 
   void printOptionValues();
   }
 
   void printOptionValues();
+
+private:
+  Option *LookupOption(StringRef &Arg, StringRef &Value);
 };
 
 } // namespace
 };
 
 } // namespace
@@ -242,8 +245,7 @@ void OptionCategory::registerCategory() {
 /// LookupOption - Lookup the option specified by the specified option on the
 /// command line.  If there is a value specified (after an equal sign) return
 /// that as well.  This assumes that leading dashes have already been stripped.
 /// LookupOption - Lookup the option specified by the specified option on the
 /// command line.  If there is a value specified (after an equal sign) return
 /// that as well.  This assumes that leading dashes have already been stripped.
-static Option *LookupOption(StringRef &Arg, StringRef &Value,
-                            const StringMap<Option *> &OptionsMap) {
+Option *CommandLineParser::LookupOption(StringRef &Arg, StringRef &Value) {
   // Reject all dashes.
   if (Arg.empty())
     return nullptr;
   // Reject all dashes.
   if (Arg.empty())
     return nullptr;
@@ -953,7 +955,7 @@ void CommandLineParser::ParseCommandLineOptions(int argc,
       while (!ArgName.empty() && ArgName[0] == '-')
         ArgName = ArgName.substr(1);
 
       while (!ArgName.empty() && ArgName[0] == '-')
         ArgName = ArgName.substr(1);
 
-      Handler = LookupOption(ArgName, Value, OptionsMap);
+      Handler = LookupOption(ArgName, Value);
       if (!Handler || Handler->getFormattingFlag() != cl::Positional) {
         ProvidePositionalOption(ActivePositionalArg, argv[i], i);
         continue; // We are done!
       if (!Handler || Handler->getFormattingFlag() != cl::Positional) {
         ProvidePositionalOption(ActivePositionalArg, argv[i], i);
         continue; // We are done!
@@ -965,7 +967,7 @@ void CommandLineParser::ParseCommandLineOptions(int argc,
       while (!ArgName.empty() && ArgName[0] == '-')
         ArgName = ArgName.substr(1);
 
       while (!ArgName.empty() && ArgName[0] == '-')
         ArgName = ArgName.substr(1);
 
-      Handler = LookupOption(ArgName, Value, OptionsMap);
+      Handler = LookupOption(ArgName, Value);
 
       // Check to see if this "option" is really a prefixed or grouped argument.
       if (!Handler)
 
       // Check to see if this "option" is really a prefixed or grouped argument.
       if (!Handler)