Debian Codegraph @

gcc/testsuite/obj-c++.dg/demangle-2.mm

raw
1 /* Test demangling an Objective-C method. */
2 /* { dg-do run } */
3 /* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
4 // { dg-additional-options "-Wno-objc-root-class" }
5
6 #include <cstring>
7 #include <cstdlib>
8 #include <iostream>
9 #include <objc/objc.h>
10
11 @interface DemangleTest
12 {
13 Class isa;
14 }
15 + (int) testFunction1;
16 + (int) test_function2;
17 + (int) __testFunction3: (int)unused andArgument: (char)unused2;
18 + (id) initialize;
19 @end
20
21 @implementation DemangleTest
22 + (int) testFunction1
23 {
24 std::cout << __PRETTY_FUNCTION__ << "\n";
25 return std::strcmp (__PRETTY_FUNCTION__, "+[DemangleTest testFunction1]");
26 }
27 + (int) test_function2
28 {
29 std::cout << __PRETTY_FUNCTION__ << "\n";
30 return std::strcmp (__PRETTY_FUNCTION__, "+[DemangleTest test_function2]");
31 }
32 + (int) __testFunction3: (int)unused andArgument: (char)unused2
33 {
34 std::cout << __PRETTY_FUNCTION__ << "\n";
35 return std::strcmp (__PRETTY_FUNCTION__, "+[DemangleTest __testFunction3:andArgument:]");
36 }
37 + (id) initialize { return self; }
38 @end
39
40 int main ()
41 {
42 if ([DemangleTest testFunction1] != 0)
43 abort ();
44
45 if ([DemangleTest test_function2] != 0)
46 abort ();
47
48 if ([DemangleTest __testFunction3:0 andArgument: 'c'] != 0)
49 abort ();
50
51 return 0;
52 }
53
54