1 // RUN: %clang_cc1 -E %s > %t.src.cpp
2 // RUN: %clang_cc1 -E %s > %t.dst.cpp -DDEST
3 // RUN: clang-diff -dump-matches -stop-diff-after=topdown %t.src.cpp %t.dst.cpp -- -std=c++11 | FileCheck %s
5 // Test the top-down matching of identical subtrees only.
11 // Match some subtree of height greater than 2.
12 // CHECK: Match CompoundStmt(3) to CompoundStmt(3)
13 // CHECK: Match CompoundStmt(4) to CompoundStmt(4)
14 // CHECK: Match NullStmt(5) to NullStmt(5)
17 // Don't match subtrees that are smaller.
18 // CHECK-NOT: Match CompoundStmt(6)
19 // CHECK-NOT: Match NullStmt(7)
22 // Greedy approach - use the first matching subtree when there are multiple
23 // identical subtrees.
24 // CHECK: Match CompoundStmt(8) to CompoundStmt(8)
25 // CHECK: Match CompoundStmt(9) to CompoundStmt(9)
26 // CHECK: Match NullStmt(10) to NullStmt(10)
38 class A
{ int x
= 1 + 1; void f() { int x1
= x
; } };
50 // CHECK-NOT: Match {{.*}} to CompoundStmt(11)
51 // CHECK-NOT: Match {{.*}} to CompoundStmt(12)
52 // CHECK-NOT: Match {{.*}} to NullStmt(13)
55 // CHECK-NOT: Match {{.*}} to NullStmt(14)
63 // CHECK: Match DeclRefExpr: :x(17) to DeclRefExpr: :x(22)
65 // CHECK: Match DeclRefExpr: x(21) to DeclRefExpr: x(26)
70 // Only the class name changed; it is not included in the field value,
71 // therefore there is no update.
72 // CHECK: Match FieldDecl: :x(int)(24) to FieldDecl: :x(int)(29)
73 // CHECK-NOT: Update FieldDecl: :x(int)(24)
76 // CHECK: Match MemberExpr: :x(32) to MemberExpr: :x(37)
77 // CHECK-NOT: Update MemberExpr: :x(32)