bool ParseArgs()

in legacy/objc/src/XPFlagRefactoring/XPFlagRefactoring.cpp [728:759]


  bool ParseArgs(const CompilerInstance &CI, const vector<string> &args) {
    // this should have only one argument
    assert(args.size() == 1);

    string s = args.at(0);
    auto comma = s.find(",");
    flagName = s.substr(0, comma);

    string remaining = s.substr(comma + 1, string::npos);

    comma = remaining.find(",");
    string strFlagType = remaining.substr(0, comma);

    if (!strFlagType.compare("control")) {
      flagType = CONTROL;
    } else if (!strFlagType.compare("treated")) {
      flagType = TREATED;
    } else if (!strFlagType.compare("optimistic")) {
      flagType = OPTIMISTIC;
    } else {
      flagType = UNDEFINED;
    }

    shouldHandleMethodImpl = true;
    if (comma != string::npos) {
      remaining = remaining.substr(comma + 1, string::npos);
      if (!remaining.compare("doNotHandleMethodImpl")) {
        shouldHandleMethodImpl = false;
      }
    }
    return true;
  }