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.
Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
Comment Actions
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.
Comment Actions
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 :-)