[llvm] [TableGen] correctly escape dependency filenames (PR #160834)

Ruoyu Zhong via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 26 10:50:57 PDT 2025


================
@@ -0,0 +1,38 @@
+// RUN: rm -rf %t; split-file %s %t
+
+//--- normal-file.td
+class NormalClass {}
+
+//--- file with spaces.td
+class SpaceClass {}
+
+//--- file#with#hash.td
+class HashClass {}
+
+//--- file$with$dollar.td
+class DollarClass {}
+
+//--- file with escape\ before spaces.td
+class EscapeBeforeSpacesClass {}
+
+//--- main.td
+include "normal-file.td"
+include "file with spaces.td"
+include "file#with#hash.td"
+include "file$with$dollar.td"
+include "file with escape\\ before spaces.td" // backslash itself needs escaping
+
+def Normal : NormalClass;
+def Spaces : SpaceClass;
+def Hash : HashClass;
+def Dollar : DollarClass;
+def EscapeBeforeSpaces : EscapeBeforeSpacesClass;
+
+// RUN: llvm-tblgen -I %t -d %t.d -o %t.out %t/main.td
+// RUN: FileCheck --input-file=%t.d %s
+
+// CHECK-DAG: normal-file.td
+// CHECK-DAG: file\ with\ spaces.td
+// CHECK-DAG: file\#with\#hash.td
+// CHECK-DAG: file$$with$$dollar.td
+// CHECK-DAG: file\ with\ escape\\\ before\ spaces.td
----------------
ZhongRuoyu wrote:

Proposed the same change in Clang and lld, respectively:

- https://github.com/llvm/llvm-project/pull/160903
- https://github.com/llvm/llvm-project/pull/160927


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


More information about the llvm-commits mailing list