[clang] [clang][CodeView] Prevent the input name from appearing in LF_BUILDINFO (PR #194140)

via cfe-commits cfe-commits at lists.llvm.org
Sun Apr 26 03:05:31 PDT 2026


================
@@ -45,3 +57,14 @@ int main(void) { return 42; }
 // MESSAGELEN: ============================================================
 // MESSAGELEN: 0x{{.+}} | LF_BUILDINFO [size = {{.+}}]
 // MESSAGELEN-NOT: -fmessage-length
+
+// The cmdline LF_STRING_ID quotes each cc1 arg, so a leaked source
+// positional appears as a quoted token. The FILEPATH LF_STRING_ID prints
+// the path without surrounding quotes, so it won't trigger the negative.
+// ABSPATH:     0x{{.+}} | LF_STRING_ID [size = {{.+}}] ID: <no type>, String: "-cc1
+// ABSPATH-NOT: "{{[^"]*[\\/]codeview-buildinfo\.c}}"
+// ABSPATH:     0x{{.+}} | LF_BUILDINFO [size = {{.+}}]
----------------
Nerixyz wrote:

Since the command line is always the fifth argument, you should be able to check the command line of `LF_BUILDINFO` too. Something like
```cpp
// ABSPATH:     0x{{.+}} | LF_BUILDINFO [size = {{.+}}]
// ABSPATH-NEXT:          0x{{.*}}: `{{.*}}`
// ABSPATH-NEXT:          0x{{.*}}: `{{.*}}`
// ABSPATH-NEXT:          0x{{.*}}: `{{.*}}`
// ABSPATH-NEXT:          0x{{.*}}: ``
// ABSPATH-NEXT:          0x{{.*}}: `
// ABSPATH-NOT: {{[^"]*[\\/]codeview-buildinfo\.c}}
// ABSPATH-SAME: `
```

https://github.com/llvm/llvm-project/pull/194140


More information about the cfe-commits mailing list