brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.7 KiB · 04e6fee Raw
79 lines · cpp
1// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm-only %s -verify -DTEST12// RUN: %clang_cc1 -triple %itanium_abi_triple-only %s -verify -DTEST2 -emit-llvm -o - | FileCheck %s3// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm-only %s -verify -DTEST34// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm-only %s -verify -DTEST45 6#ifdef TEST17 8class MyClass {9 static void meth();10};11void MyClass::meth() { } // expected-note {{previous}}12extern "C" {13  void _ZN7MyClass4methEv() { } // expected-error {{definition with same mangled name '_ZN7MyClass4methEv' as another definition}}14}15 16#elif TEST217 18// expected-no-diagnostics19 20// We expect no warnings here, as there is only declaration of _ZN1TD1Ev21// function, no definitions.22extern "C" void _ZN1TD1Ev();23struct T {24  ~T() {}25};26 27// We expect no warnings here, as there is only declaration of _ZN2nm3abcE28// global, no definitions.29extern "C" {30  int _ZN2nm3abcE;31}32 33namespace nm {34  float abc = 2;35}36// CHECK: @_ZN2nm3abcE = {{(dso_local )?}}global float37 38float foo() {39  _ZN1TD1Ev();40// CHECK: call void @_ZN1TD1Ev()41  T t;42// CHECK: call {{.*}} @_ZN1TD1Ev(ptr {{[^,]*}} %t)43  return _ZN2nm3abcE + nm::abc;44}45 46#elif TEST347 48extern "C" void _ZN2T2D2Ev() {}; // expected-note {{previous definition is here}}49 50struct T2 {51  ~T2() {} // expected-error {{definition with same mangled name '_ZN2T2D2Ev' as another definition}}52};53 54void foo() {55  _ZN2T2D2Ev();56  T2 t;57}58 59#elif TEST460 61extern "C" {62  int _ZN2nm3abcE = 1; // expected-note {{previous definition is here}}63}64 65namespace nm {66  float abc = 2; // expected-error {{definition with same mangled name '_ZN2nm3abcE' as another definition}}67}68 69float foo() {70  return _ZN2nm3abcE + nm::abc;71}72 73#else74 75#error Unknown test76 77#endif78 79