// { dg-options "-Wabi-tag" } struct __attribute ((abi_tag ("X"))) A { }; struct B // { dg-warning "ABI tag" } { virtual void f(A); // { dg-message "declared here" } };
// { dg-options "-Wabi-tag" } // { dg-final { scan-assembler "_Z1fB3barB3fooi" } } void f(int) __attribute ((abi_tag ("foo","bar"))); struct __attribute ((abi_tag ("bar"))) A { }; struct B: A { }; // { dg-warning "bar. ABI tag" } struct D { A* ap; }; // { dg-warning "bar. ABI tag" } // { dg-final { scan-assembler "_Z1gB3baz1AB3bar" } } void g(A) __attribute ((abi_tag ("baz"))); void g(A) __attribute ((abi_tag ("baz"))); int main() { f(42); g(A()); }
// { dg-final { scan-assembler "_Z3fi1B6_X_tagv" } } struct __attribute((abi_tag("_A1_tag"))) A1 {}; template <class T> struct __attribute((abi_tag("_X_tag"))) X {}; X<int> fi1(); int main() { X<A1> xa; fi1(); }
// { dg-final { scan-assembler "_Z1fSsB3fooS_" } } namespace std { template <class T> struct char_traits {}; template <class T> struct allocator {}; template <class T, class U, class V> struct __attribute ((abi_tag ("foo"))) basic_string { }; typedef basic_string<char,char_traits<char>,allocator<char> > string; } void f(std::string,std::string) {}
// PR c++/71712 // { dg-options -Wabi=10 } struct __attribute__((abi_tag("A", "B"))) A { }; struct A18 { operator A(); // { dg-warning "mangled name" } }; void f18_test() { // { dg-final { scan-assembler "_ZN3A18cv1AB1AB1BEv" } } A a = A18(); }
// PR c++/60642 struct __attribute((abi_tag("test"))) foo { void f(); virtual ~foo(); }; template<typename> struct __attribute((abi_tag("test"))) bar { void f(); virtual ~bar(); }; int main() { foo f; f.f(); bar<int> b; b.f(); } // { dg-final { scan-assembler "_ZTV3barB4testIiE" } }
// RUN: %clang_cc1 %s -emit-llvm -triple %itanium_abi_triple -std=c++11 -o - | FileCheck %s // RUN: %clang_cc1 %s -emit-llvm -triple i686-linux-gnu -std=c++11 -o - | FileCheck %s // RUN: %clang_cc1 %s -emit-llvm -triple x86_64-linux-gnu -std=c++11 -o - | FileCheck %s // RUN: %clang_cc1 %s -emit-llvm -triple powerpc64le-unknown-linux-gnu -std=c++11 -o - | FileCheck %s struct __attribute__((abi_tag("A", "B"))) A { }; struct B: A { }; template<class T> struct C { }; struct D { A* p; }; template<class T> struct __attribute__((abi_tag("C", "D"))) E { }; struct __attribute__((abi_tag("A", "B"))) F { }; A a1; // CHECK-DAG: @_Z2a1B1AB1B = __attribute__((abi_tag("C", "D"))) A a2; // CHECK-DAG: @_Z2a2B1AB1BB1CB1D = B a3; // CHECK-DAG: @a3 =
#include <stdio.h> class A { public: int __attribute__((abi_tag("cxx11"))) test_abi_tag() { return 1; } int test_asm_name() asm("A_test_asm") { return 2; } }; int main(int argc, char **argv) { A a; // Break here a.test_abi_tag(); a.test_asm_name(); return 0; }
// { dg-options "-Wabi-tag" } inline namespace __cxx11 __attribute ((abi_tag ("cxx11"))) { struct A {}; }; // { dg-final { scan-assembler "_Z1aB5cxx11" } } A a; // { dg-warning "\"cxx11\"" } // { dg-final { scan-assembler "_Z1fB5cxx11v" } } A f() {} // { dg-warning "\"cxx11\"" } namespace { A a2; A f2() {} struct B: A {}; } // { dg-final { scan-assembler "_Z1fPN7__cxx111AE" } } A f(A*) {} // { dg-final { scan-assembler "_Z1gIN7__cxx111AEET_v" } } template <class T> T g() { } template <> A g<A>() { } // { dg-final { scan-assembler "_Z1vIN7__cxx111AEE" { target c++14 } } } #if __cplusplus >= 201402L template <class T> T v = T(); void *p = &v<A>; #endif