1 | // RUN: clang-diff -dump-matches %S/Inputs/clang-diff-basic-src.cpp %s -- | FileCheck %s |
2 | |
3 | // CHECK: Match TranslationUnitDecl{{.*}} to TranslationUnitDecl |
4 | // CHECK: Match NamespaceDecl: src{{.*}} to NamespaceDecl: dst |
5 | namespace dst { |
6 | // CHECK-NOT: Match NamespaceDecl: src{{.*}} to NamespaceDecl: inner |
7 | namespace inner { |
8 | void foo() { |
9 | // CHECK: Match IntegerLiteral: 321{{.*}} to IntegerLiteral: 322 |
10 | int x = 322; |
11 | } |
12 | } |
13 | |
14 | // CHECK: Match DeclRefExpr: :foo{{.*}} to DeclRefExpr: :inner::foo |
15 | void main() { inner::foo(); } |
16 | |
17 | // CHECK: Match StringLiteral: foo{{.*}} to StringLiteral: foo |
18 | const char *b = "f" "o" "o"; |
19 | |
20 | // unsigned is canonicalized to unsigned int |
21 | // CHECK: Match TypedefDecl: :nat;unsigned int;{{.*}} to TypedefDecl: :nat;unsigned int; |
22 | typedef unsigned nat; |
23 | |
24 | // CHECK: Match VarDecl: :p(int){{.*}} to VarDecl: :prod(double) |
25 | // CHECK: Update VarDecl: :p(int){{.*}} to :prod(double) |
26 | // CHECK: Match BinaryOperator: *{{.*}} to BinaryOperator: * |
27 | double prod = 1 * 2 * 10; |
28 | // CHECK: Update DeclRefExpr |
29 | int squared = prod * prod; |
30 | |
31 | class X { |
32 | const char *foo(int i) { |
33 | if (i == 0) |
34 | return "Bar"; |
35 | // CHECK: Insert IfStmt{{.*}} into IfStmt |
36 | // CHECK: Insert BinaryOperator: =={{.*}} into IfStmt |
37 | else if (i == -1) |
38 | return "foo"; |
39 | return 0; |
40 | } |
41 | X(){} |
42 | }; |
43 | } |
44 | |
45 | // CHECK: Move CompoundStmt{{.*}} into CompoundStmt |
46 | void m() { { int x = 0 + 0 + 0; } } |
47 | // CHECK: Update and Move IntegerLiteral: 7{{.*}} into BinaryOperator: +({{.*}}) at 1 |
48 | int um = 1 + 7; |
49 | |
50 | namespace { |
51 | // match with parents of different type |
52 | // CHECK: Match FunctionDecl: f1{{.*}} to FunctionDecl: (anonymous namespace)::f1 |
53 | void f1() {{ (void) __func__;;; }} |
54 | } |
55 | |
56 | // CHECK: Delete AccessSpecDecl: public |
57 | // CHECK: Delete CXXMethodDecl |
58 | |