File: raw-strings.cpp

package info (click to toggle)
llvm-toolchain-21 1%3A21.1.6-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,245,028 kB
  • sloc: cpp: 7,619,726; ansic: 1,434,018; asm: 1,058,748; python: 252,740; f90: 94,671; objc: 70,685; lisp: 42,813; pascal: 18,401; sh: 8,601; ml: 5,111; perl: 4,720; makefile: 3,675; awk: 3,523; javascript: 2,409; xml: 892; fortran: 770
file content (148 lines) | stat: -rw-r--r-- 2,517 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
// RUN: rm -rf %t
// RUN: split-file %s %t
// RUN: sed -e "s|DIR|%/t|g" %t/cdb.json.in > %t/cdb.json

//--- cdb.json.in
[{
    "directory": "DIR",
    "command": "clang -c DIR/tu.c -o DIR/tu.o -IDIR/include",
    "file": "DIR/tu.c"
}]
//--- include/header.h
//--- include/header2.h
//--- include/header3.h
//--- include/header4.h
//--- include/header5.h
//--- include/header6.h
//--- include/header7.h
//--- include/header8.h
//--- include/header9.h
//--- include/header10.h
//--- include/header11.h
//--- include/header12.h
//--- include/header13.h
//--- include/header14.h
//--- tu.c
#if 0
R"x()x"
#endif

#include "header.h"

#if 0
R"y(";
#endif
#include "header2.h"

#if 0
//")y"
#endif

#if 0
R"y(";
R"z()y";
#endif
#include "header3.h"
#if 0
//")z"
#endif

#if 0
R\
"y(";
R"z()y";
#endif
#include "header4.h"
#if 0
//")z"
#endif

// Test u8 prefix with escaped newline
#if 0
u8R\
"prefix(test)prefix"
#endif
#include "header5.h"

// Test u prefix with multiple escaped newlines
#if 0
uR\
\
"multi(test)multi"
#endif
#include "header6.h"

// Test U prefix with escaped newline
#if 0
UR\
"upper(test)upper"
#endif
#include "header7.h"

// Test L prefix with escaped newline
#if 0
LR\
"wide(test)wide"
#endif
#include "header8.h"

// Test escaped newline with \r\n style
#if 0
R\
"crlf(test)crlf"
#endif
#include "header9.h"

// Test multiple escaped newlines in different positions
#if 0
u\
8\
R\
"complex(test)complex"
#endif
#include "header10.h"

// Test raw string that should NOT be treated as raw (no R prefix due to identifier continuation)
#if 0
identifierR"notraw(test)notraw"
#endif
#include "header11.h"

// Test raw string with whitespace before escaped newline
#if 0
R \
"whitespace(test)whitespace"
#endif
#include "header12.h"

// Test nested raw strings in disabled code
#if 0
R"outer(
    R"inner(content)inner"
)outer"
#endif
#include "header13.h"

// Test raw string with empty delimiter
#if 0
R\
"(empty delimiter)";
#endif
#include "header14.h"

// RUN: clang-scan-deps -compilation-database %t/cdb.json -mode preprocess | FileCheck %s
// RUN: clang-scan-deps -compilation-database %t/cdb.json -mode preprocess-dependency-directives | FileCheck %s
// CHECK: tu.c
// CHECK-NEXT: header.h
// CHECK-NEXT: header3.h
// CHECK-NEXT: header4.h
// CHECK-NEXT: header5.h
// CHECK-NEXT: header6.h
// CHECK-NEXT: header7.h
// CHECK-NEXT: header8.h
// CHECK-NEXT: header9.h
// CHECK-NEXT: header10.h
// CHECK-NEXT: header11.h
// CHECK-NEXT: header12.h
// CHECK-NEXT: header13.h
// CHECK-NEXT: header14.h