[AMDGPU][True16][CodeGen] true16 codegen pattern for v_med3_u/i16 (#121850)
[llvm-project.git] / clang / test / CodeGenCXX / duplicate-mangled-name.cpp
blob04e6fee506ebd78f136096c59c86fb2c27d4db2e
1 // RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm-only %s -verify -DTEST1
2 // RUN: %clang_cc1 -triple %itanium_abi_triple-only %s -verify -DTEST2 -emit-llvm -o - | FileCheck %s
3 // RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm-only %s -verify -DTEST3
4 // RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm-only %s -verify -DTEST4
6 #ifdef TEST1
8 class MyClass {
9 static void meth();
11 void MyClass::meth() { } // expected-note {{previous}}
12 extern "C" {
13 void _ZN7MyClass4methEv() { } // expected-error {{definition with same mangled name '_ZN7MyClass4methEv' as another definition}}
16 #elif TEST2
18 // expected-no-diagnostics
20 // We expect no warnings here, as there is only declaration of _ZN1TD1Ev
21 // function, no definitions.
22 extern "C" void _ZN1TD1Ev();
23 struct T {
24 ~T() {}
27 // We expect no warnings here, as there is only declaration of _ZN2nm3abcE
28 // global, no definitions.
29 extern "C" {
30 int _ZN2nm3abcE;
33 namespace nm {
34 float abc = 2;
36 // CHECK: @_ZN2nm3abcE = {{(dso_local )?}}global float
38 float foo() {
39 _ZN1TD1Ev();
40 // CHECK: call void @_ZN1TD1Ev()
41 T t;
42 // CHECK: call {{.*}} @_ZN1TD1Ev(ptr {{[^,]*}} %t)
43 return _ZN2nm3abcE + nm::abc;
46 #elif TEST3
48 extern "C" void _ZN2T2D2Ev() {}; // expected-note {{previous definition is here}}
50 struct T2 {
51 ~T2() {} // expected-error {{definition with same mangled name '_ZN2T2D2Ev' as another definition}}
54 void foo() {
55 _ZN2T2D2Ev();
56 T2 t;
59 #elif TEST4
61 extern "C" {
62 int _ZN2nm3abcE = 1; // expected-note {{previous definition is here}}
65 namespace nm {
66 float abc = 2; // expected-error {{definition with same mangled name '_ZN2nm3abcE' as another definition}}
69 float foo() {
70 return _ZN2nm3abcE + nm::abc;
73 #else
75 #error Unknown test
77 #endif