xref: /aosp_15_r20/external/clang/test/Preprocessor/output_paste_avoid.cpp (revision 67e74705e28f6214e480b399dd47ea732279e315)
1  // RUN: %clang_cc1 -E -std=c++11 %s -o - | FileCheck -strict-whitespace %s
2  
3  
4  #define y(a) ..a
5  A: y(.)
6  // This should print as ".. ." to avoid turning into ...
7  // CHECK: A: .. .
8  
9  #define X 0 .. 1
10  B: X
11  // CHECK: B: 0 .. 1
12  
13  #define DOT .
14  C: ..DOT
15  // CHECK: C: .. .
16  
17  
18  #define PLUS +
19  #define EMPTY
20  #define f(x) =x=
21  D: +PLUS -EMPTY- PLUS+ f(=)
22  // CHECK: D: + + - - + + = = =
23  
24  
25  #define test(x) L#x
26  E: test(str)
27  // Should expand to L "str" not L"str"
28  // CHECK: E: L "str"
29  
30  // Should avoid producing >>=.
31  #define equal =
32  F: >>equal
33  // CHECK: F: >> =
34  
35  // Make sure we don't introduce spaces in the guid because we try to avoid
36  // pasting '-' to a numeric constant.
37  #define TYPEDEF(guid)   typedef [uuid(guid)]
38  TYPEDEF(66504301-BE0F-101A-8BBB-00AA00300CAB) long OLE_COLOR;
39  // CHECK: typedef [uuid(66504301-BE0F-101A-8BBB-00AA00300CAB)] long OLE_COLOR;
40  
41  // Be careful with UD-suffixes.
42  #define StrSuffix() "abc"_suffix
43  #define IntSuffix() 123_suffix
44  UD: StrSuffix()ident
45  UD: IntSuffix()ident
46  // CHECK: UD: "abc"_suffix ident
47  // CHECK: UD: 123_suffix ident
48