Skip to content

Commit daac47d

Browse files
Tommy McMichenbcardosolopes
authored andcommitted
[CIR][NFC] Update vtable test
1 parent 9fcb778 commit daac47d

File tree

2 files changed

+29
-6
lines changed

2 files changed

+29
-6
lines changed

clang/test/CIR/CodeGen/vtable-available-externally.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
// RUN: %clang_cc1 %s -I%S -triple x86_64-unknown-linux-gnu -std=c++98 -O0 -disable-llvm-passes -emit-cir -o %t
1+
// RUN: %clang_cc1 %s -I%S -I%S/../Inputs -triple x86_64-unknown-linux-gnu -std=c++98 -O0 -disable-llvm-passes -emit-cir -o %t
22
// RUN: FileCheck -allow-deprecated-dag-overlap --check-prefix=CHECK %s < %t
3-
// RUN: %clang_cc1 %s -I%S -triple x86_64-unknown-linux-gnu -std=c++98 -O2 -disable-llvm-passes -emit-cir -o %t.opt
3+
// RUN: %clang_cc1 %s -I%S -I%S/../Inputs -triple x86_64-unknown-linux-gnu -std=c++98 -O2 -disable-llvm-passes -emit-cir -o %t.opt
44
// RUN: FileCheck -allow-deprecated-dag-overlap --check-prefix=CHECK-FORCE-EMIT %s < %t.opt
55

6+
#include "typeinfo"
7+
68
// CHECK: cir.global{{.*}} external @_ZTV1A
7-
// CHECK-FORCE-EMIT: cir.global{{.*}} available_externally @_ZTV1A
9+
// CHECK-FORCE-EMIT-DAG: cir.global{{.*}} available_externally @_ZTV1A
810
struct A {
911
A();
1012
virtual void f();
@@ -16,9 +18,6 @@ A::A() { }
1618
void f(A* a) {
1719
a->f();
1820
};
19-
20-
// CHECK-LABEL: cir.func{{.*}} @_Z1gv
21-
// CHECK: cir.call @_Z1fP1A
2221
void g() {
2322
A a;
2423
f(&a);

clang/test/CIR/Inputs/typeinfo

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
namespace std {
2+
class type_info {
3+
public:
4+
virtual ~type_info();
5+
const char* name() const { return __name; }
6+
bool operator==(const type_info& __arg) const {
7+
return __name == __arg.__name;
8+
}
9+
10+
bool operator!=(const type_info& __arg) const {
11+
return !operator==(__arg);
12+
}
13+
14+
bool before(const type_info& __arg) const {
15+
return __name < __arg.__name;
16+
}
17+
18+
unsigned long hash_code() const {
19+
return reinterpret_cast<unsigned long long>(__name);
20+
}
21+
protected:
22+
const char *__name;
23+
};
24+
}

0 commit comments

Comments
 (0)