We have a Field struct which has a StringRef member Str.
The code needs to create and keep alive the temporarily std::string variables because of that.
That is not convenient and makes the code be more complicated than it could be.
I see no reason to keep Str be StringRef and suggest to make it std::string.
This patch does that and also rearranges the code slightly to regroup it in a
more natural way after the change.
Could this still take a StringRef?