Clang Project

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