1 //===-- DemangleTest.cpp --------------------------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #include "llvm/Demangle/Demangle.h"
10 #include "gmock/gmock.h"
14 TEST(Demangle
, demangleTest
) {
15 EXPECT_EQ(demangle("_"), "_");
16 EXPECT_EQ(demangle("_Z3fooi"), "foo(int)");
17 EXPECT_EQ(demangle("__Z3fooi"), "foo(int)");
18 EXPECT_EQ(demangle("___Z3fooi_block_invoke"),
19 "invocation function for block in foo(int)");
20 EXPECT_EQ(demangle("____Z3fooi_block_invoke"),
21 "invocation function for block in foo(int)");
22 EXPECT_EQ(demangle("?foo@@YAXH@Z"), "void __cdecl foo(int)");
23 EXPECT_EQ(demangle("foo"), "foo");
24 EXPECT_EQ(demangle("_RNvC3foo3bar"), "foo::bar");
25 EXPECT_EQ(demangle("__RNvC3foo3bar"), "foo::bar");
26 EXPECT_EQ(demangle("_Dmain"), "D main");
28 // Regression test for demangling of optional template-args for vendor
29 // extended type qualifier (https://bugs.llvm.org/show_bug.cgi?id=48009)
30 EXPECT_EQ(demangle("_Z3fooILi79EEbU7_ExtIntIXT_EEi"),
31 "bool foo<79>(int _ExtInt<79>)");