Loading
[clang][CodeView] Prevent the input name from appearing in LF_BUILDINFO (#194140)
The implicit contract of an `LF_BUILDINFO` record (represented in LLVM by [`BuildInfoRecord`](https://github.com/llvm/llvm-project/blob/6f0b55ec55f3e5e1ccc0d6b0d04a307479218768/llvm/include/llvm/DebugInfo/CodeView/TypeRecord.h#L667)) is that its `CommandLine` field should not contain the input source file — a separate `SourceFile` field is reserved for that. When the command-line flattening was moved from `llvm/` to `clang/` in #106369, the comparison value used to identify and strip the source positional was switched from `MainSourceFile->getFilename()` (the full input path resolved by clang) to `CodeGenOpts.MainFileName` (just the basename, set via `-main-file-name`). As a result, when the driver is invoked with an absolute source path the cc1 positional is that absolute path and no longer matches `MainFileName`, so the source filename leaks into `CommandLine` as a trailing positional cc1 argument. This is a regression in Clang 20. It breaks downstream tooling such as Live++, whose unity-splitting feature relies on the embedded command line being the cc1 invocation minus the source. Reported in #193900. This PR restores the previous behavior by passing the resolved frontend input path(s) to `flattenClangCommandLine` and including them in the equality check that strips the source positional. The basename match against `MainFileName` is kept for the relative-input case. A regression test (and a symmetric relative-path test) is added to `clang/test/DebugInfo/Generic/codeview-buildinfo.c`. Should fix #193900.