Driver: Pass some std::strings by reference instead of value

No functional change intended. This fixes PR21463.