1 // -*- C++ -*- 2 //===----------------------------------------------------------------------===// 3 // 4 // The LLVM Compiler Infrastructure 5 // 6 // This file is dual licensed under the MIT and the University of Illinois Open 7 // Source Licenses. See LICENSE.TXT for details. 8 // 9 //===----------------------------------------------------------------------===// 10 #include "demangle.h" 11 #include <typeinfo> 12 #include <cassert> 13 14 struct MyType {}; 15 16 template <class T, class U> struct ArgumentListID {}; 17 main()18int main() { 19 struct { 20 const char* raw; 21 const char* expect; 22 } TestCases[] = { 23 {typeid(int).name(), "int"}, 24 {typeid(MyType).name(), "MyType"}, 25 {typeid(ArgumentListID<int, MyType>).name(), "ArgumentListID<int, MyType>"} 26 }; 27 const size_t size = sizeof(TestCases) / sizeof(TestCases[0]); 28 for (size_t i=0; i < size; ++i) { 29 const char* raw = TestCases[i].raw; 30 const char* expect = TestCases[i].expect; 31 #ifdef TEST_HAS_NO_DEMANGLE 32 assert(demangle(raw) == raw); 33 ((void)expect); 34 #else 35 assert(demangle(raw) == expect); 36 #endif 37 } 38 } 39