The changes adds support for -fno-builtin-foo options.
This addresses PR4941 and rdar://6756912.
Please take a look.
Can you use a StringSet instead of a vector and avoid all (most) of the code iterating over the vector of builtins being disabled?
I'd remove this; there's no need for Clang to know about all functions that the optimizer knows about, and thus for which adding the nobuiltin attribute might be useful.
I began converting the code to use StringSets, but I soon realized this wasn't as trivial of a change as one would hope. There are number of places where the LangOptions and CodeGenOptions are copied (e.g., Lexer.cpp:133, PrettyPrinter.h:38, ModuleBuilder.cpp:66) . Unfortunately, this copying requires a copy constructor for the StringSets. I'd prefer to stick with a simple string vector as any code saved by not iterating over the vector is lost on the copy constructor implementation. FWIW, I also don't believe this to be performance critical code.. Please let me know your thoughts.
Regarding the FIXME in lib/Frontend/CompilerInvocation.cpp: I agree with Hal that you can remove that. We used to complain about unsupported -fno-builtin-* options (and until now they have *all* been unsupported), but in r191434, Rafael changed clang to silently ignore those options, with the explanation that it matches gcc's behavior. Assuming that gcc has not changed in that regard, it makes sense that we should continue to ignore -fno-builtin-* for unsupported options.
Remove the FIXME, per Hal and Bob's request. I confirmed that gcc does not warn for invalid -fno-builtin-foo options.
Also, pass the vector by reference and insert, rather than making an unnecessary copy on the return in CompilerInvocation.