Files
TheRock/compiler/amd-llvm/clang/test/Tooling/clang-diff-topdown.cpp
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

84 lines
1.8 KiB
C++

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