This is a spin-off of a review Emit Clang version information into .comment section (LLVM's part of implementation) [PART 2]
http://llvm-reviews.chandlerc.com/D1729
The reviewer, Rafael Espíndola, asked to split LLVM's part of the patch into two separate patches (CodeGen and MC). Here is the CodeGen part of the patch with the few corrections.
please use cast instead of dyn_cast and have the verifier check that we only get strings in here.