[llvm] Strip the full path from __FILE__ in the LDBG macro and keep only the filename (PR #150677)

Mehdi Amini via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 25 12:30:03 PDT 2025


================
@@ -51,6 +59,16 @@ class LogWithNewline {
   LogWithNewline(const LogWithNewline &) = delete;
   LogWithNewline &operator=(const LogWithNewline &) = delete;
   LogWithNewline &operator=(LogWithNewline &&) = delete;
+  static constexpr const char *getFileName(const char *path) {
+    // Remove the path prefix from the file name.
+    const char *filename = path;
+    for (const char *p = path; *p != '\0'; ++p) {
----------------
joker-eph wrote:

I just implemented this method, let me know WDYT?

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


More information about the llvm-commits mailing list