<div>Hmm, I see both Anton's point about the ugliness of this code, and your point about there being no good way to do this.</div><div><br></div><div>The ideal way to manage this in Clang/LLVM land is something along the lines of the following.</div>
<div><br></div><div>Define in some class or interface an enum representing the viable modes to be selected here. Then provide a parse routine which converts a string into the enum as follows:</div><div><br></div><div>class ... {</div>
<div>  enum MyFeatureKind {</div><div>    MFK_Foo, // "foo"</div><div>    MFK_Bar  // "bar"</div><div>  };</div><div><br></div><div>  MyFeatureKind parseFeatureString(StringRef S) {</div><div>    return llvm::StringSwitch<MyFeatureKind>(S)</div>
<div>        .Case("foo", MFK_Foo)</div><div>        .Case("bar", MFK_Bar);</div><div>  }</div><div>}</div><div><br></div><div><br></div><div>And then in the driver you have your object and write:</div>
<div><br></div><div>  // ...</div><div>  switch (obj->parseFeatureString(...)) {</div><div>    case MFK_Foo:</div><div>      ...</div><div>      break;</div><div>  }</div><div><br></div><div><br></div><div>If there happens to be a one-to-one mapping you can use a table indexed by the enum, or you can directly use StringSwitch to parse the string and produce the single value. I think if there are multiple, the switch over the enum is pretty clear.</div>
<div><br></div><div>That said, we have a lot of code with if statements in the driver... I'm actually OK with your original patch's implementation as the existing code was already structured that way, and it's not clear there is a good place for this FPU enum to live, get parsed into, etc. If you do see a place, and would like to refactor things into a structure such as the above, awesome, but I'd actually prefer you apply your first patch, and *then* do the refactor.</div>
<div><br></div><div>However, before you apply the first patch, can you add test cases? You should be able to add a test case under test/Driver that ensures the proper flags get forwarded down the chain.</div>