Clang Project

clang_source_code/test/Index/print-mangled-name.cpp
1// REQUIRES: x86-registered-target
2// RUN: c-index-test -write-pch %t_linux.ast -target i686-pc-linux-gnu %s
3// RUN: c-index-test -test-print-mangle %t_linux.ast | FileCheck %s --check-prefix=ITANIUM
4
5// RUN: c-index-test -write-pch %t_macho.ast -target x86_64-apple-darwin %s
6// RUN: c-index-test -test-print-mangle %t_macho.ast | FileCheck %s --check-prefix=MACHO
7
8// RUN: c-index-test -write-pch %t_msft.ast -target i686-pc-win32 %s
9// RUN: c-index-test -test-print-mangle %t_msft.ast | FileCheck %s --check-prefix=MICROSOFT
10
11int foo(int, int);
12// ITANIUM: mangled=_Z3fooii
13// MACHO: mangled=__Z3fooii
14// MICROSOFT: mangled=?foo@@YAHHH
15
16int foo(float, int);
17// ITANIUM: mangled=_Z3foofi
18// MACHO: mangled=__Z3foofi
19// MICROSOFT: mangled=?foo@@YAHMH
20
21struct S {
22  int x, y;
23};
24// ITANIUM: StructDecl{{.*}}mangled=]
25// MACHO: StructDecl{{.*}}mangled=]
26// MICROSOFT: StructDecl{{.*}}mangled=]
27
28int foo(S, S&);
29// ITANIUM: mangled=_Z3foo1SRS_
30// MACHO: mangled=__Z3foo1SRS_
31// MICROSOFT: mangled=?foo@@YAHUS
32
33extern "C" int foo(int);
34// ITANIUM: mangled=foo
35// MACHO: mangled=_foo
36// MICROSOFT: mangled=_foo
37