xref: /aosp_15_r20/external/clang/test/Frontend/dependency-gen-escaping.c (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li // PR15642
2*67e74705SXin Li // RUN: %clang -M -MG -fno-ms-compatibility %s | FileCheck -strict-whitespace %s --check-prefix=CHECK --check-prefix=SEP2F
3*67e74705SXin Li // RUN: %clang -M -MG -fms-compatibility %s | FileCheck -strict-whitespace %s --check-prefix=CHECK --check-prefix=SEP5C
4*67e74705SXin Li // RUN: %clang -M -MG -MV %s | FileCheck -strict-whitespace %s --check-prefix=NMAKE
5*67e74705SXin Li 
6*67e74705SXin Li // CHECK: \ \ \ \ .h
7*67e74705SXin Li // CHECK: $$$$.h
8*67e74705SXin Li // CHECK: \#\#.h
9*67e74705SXin Li // NMAKE: "    .h"
10*67e74705SXin Li // NMAKE: "$$.h"
11*67e74705SXin Li // NMAKE: "##.h"
12*67e74705SXin Li // NMAKE-NOT: "
13*67e74705SXin Li // NMAKE: normal.h
14*67e74705SXin Li // NMAKE-NOT: "
15*67e74705SXin Li 
16*67e74705SXin Li #include "    .h"
17*67e74705SXin Li #include "$$.h"
18*67e74705SXin Li #include "##.h"
19*67e74705SXin Li #include "normal.h"
20*67e74705SXin Li 
21*67e74705SXin Li // Backslash followed by # or space should escape both characters, because
22*67e74705SXin Li // that's what GNU Make wants.  GCC does the right thing with space, but not
23*67e74705SXin Li // #, so Clang does too. (There should be 3 backslashes before the #.)
24*67e74705SXin Li // SEP2F: a\b\\#c\\\ d.h
25*67e74705SXin Li // With -fms-compatibility, Backslashes in #include are treated as path separators.
26*67e74705SXin Li // Backslashes are given in the emission for special characters, like 0x20 or 0x23.
27*67e74705SXin Li // SEP5C: a{{[/\\]}}b{{[/\\]}}\#c{{/|\\\\}}\ d.h
28*67e74705SXin Li // These combinations are just another case for NMAKE.
29*67e74705SXin Li // NMAKE: "a{{[/\\]}}b{{[/\\]}}#c{{[/\\]}} d.h"
30*67e74705SXin Li 
31*67e74705SXin Li #include "a\b\#c\ d.h"
32