Emitting full clang command line into Debug Info

For CodeView compatibility purposes, we need to be able to emit the full command line of the clang driver into the debug info (cc1 command line is fine, at least for CV purposes).

rnk@ tells me that he vaguely recalls some people needing this before, but he can’t recall if there’s been an actual effort to submit patches to this effect that got blocked on something, or if people are maintaining similar patches downstream, or none of the above / something else.

Has anyone attempted something like this before?

I did something similar not for the debug info, but for the HTML reports emitted by the analyzer: https://reviews.llvm.org/D42269

+ Steven who did some work on storing the cc1 options for embedded bitcode.

GCC produces the full command line in its producer string, Clang doesn’t. This may’ve come up in previous discussions/review threads, but I’m not entirely sure.

There’s this: https://reviews.llvm.org/D30760 - -grecord-gcc-switches. So there’s already a “flags” field in DICompileUnit you can use, and maybe just add your condition (“if codeview”) to the code in clang that conditionally populates that field.

The embed bitcode option does embed all the cc1 command line in the bitcode but there is not a mode to embed only the command line right now. The implementation is in lib/CodeGen/BackendUtil.cpp.

Steven