forked from root-project/root
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Continuation.C
73 lines (57 loc) · 1.76 KB
/
Continuation.C
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
//------------------------------------------------------------------------------
// CLING - the C++ LLVM-based InterpreterG :)
//
// This file is dual-licensed: you can choose to license it under the University
// of Illinois Open Source License or the GNU Lesser General Public License. See
// LICENSE.TXT for details.
//------------------------------------------------------------------------------
// RUN: cat %s | %cling -Xclang -verify 2>&1 | FileCheck %s
// Tests continuation of a line with , or \
// Be careful saving this file: some editors strip the trailing spaces at bottom
extern "C" int printf(const char*, ...);
int Ac = 15,
Bc = 25,
Cc = 35;
Ac
// CHECK: (int) 15
Bc
// CHECK-NEXT: (int) 25
Cc
// CHECK-NEXT: (int) 35
static void InvokeTest(int A,
int B) { printf("Invoke: %d, %d\n", A, B); }
InvokeTest(Ac,
Bc);
// CHECK-NEXT: Invoke: 15, 25
int A = 10, \
B = 20, \
C = 30;
A
// CHECK-NEXT: (int) 10
B
// CHECK-NEXT: (int) 20
C
// CHECK-NEXT: (int) 30
#define CLING_MULTILINE_STRING "A" \
"B" \
" C D"
CLING_MULTILINE_STRING
// CHECK-NEXT: (const char [7]) "AB C D"
"Multinline" \
" String " \
"Constant"
"Separate"
// CHECK-NEXT: (const char [27]) "Multinline String Constant"
// CHECK-NEXT: (const char [9]) "Separate"
// Common error handling macro
#define CLING_MULTILINE_MACRO(STR) do { \
printf(STR "\n"); } while(0)
CLING_MULTILINE_MACRO("DOWHILE");
// CHECK-NEXT: DOWHILE
#define CLING_MULTILINE_TRAILING_SPACE \
"Trailing Space " \
"And A Tab" \
" End" // expected-warning@1 {{backslash and newline separated by space}} // expected-warning@2 {{backslash and newline separated by space}}
CLING_MULTILINE_TRAILING_SPACE
// CHECK-NEXT: (const char [29]) "Trailing Space And A Tab End"
.q