StringSwitch currently fakes Optional<T> by storing a pointer to the result. The problem with this approach is that it forces the compiler to store all case results on the stack before entering the string switch just so the address of the result can be temporarily used.
Heh, I was probably thinking that one might want to produce references, but I don’t anyone does. I do think it would be valuable to make the parameters “T value” instead of “const T value”, and std::move them into place when we find a match.
Thanks for the feedback Doug. I can certainly make the std::move change. Separately and to the best of my knowledge, I don't have commit privileges to LLVM proper, so somebody else will need to merge this. Thanks :-)