diff options
author | James Henderson <jh7370@my.bristol.ac.uk> | 2019-01-17 15:18:44 +0000 |
---|---|---|
committer | James Henderson <jh7370@my.bristol.ac.uk> | 2019-01-17 15:18:44 +0000 |
commit | ce5b5b486a71939913b1a0909498f216b5528401 (patch) | |
tree | b82d02f6abbae0060909f263503a50d3ea206227 /llvm/unittests/Demangle/DemangleTest.cpp | |
parent | 7630e0bcbe087918b31ba018af742a59989550df (diff) | |
download | bcm5719-llvm-ce5b5b486a71939913b1a0909498f216b5528401.tar.gz bcm5719-llvm-ce5b5b486a71939913b1a0909498f216b5528401.zip |
Move demangling function from llvm-objdump to Demangle library
This allows it to be used in an upcoming llvm-readobj change.
A small change in internal behaviour of the function is to always call
the microsoftDemangle function if the string does not have an itanium
encoding prefix, rather than only if it starts with '?'. This is
harmless because the microsoftDemangle function does the same check
already.
Reviewed by: grimar, erik.pilkington
Differential Revision: https://reviews.llvm.org/D56721
llvm-svn: 351448
Diffstat (limited to 'llvm/unittests/Demangle/DemangleTest.cpp')
-rw-r--r-- | llvm/unittests/Demangle/DemangleTest.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/llvm/unittests/Demangle/DemangleTest.cpp b/llvm/unittests/Demangle/DemangleTest.cpp new file mode 100644 index 00000000000..f60122cc137 --- /dev/null +++ b/llvm/unittests/Demangle/DemangleTest.cpp @@ -0,0 +1,19 @@ +//===-- DemangleTest.cpp --------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "llvm/Demangle/Demangle.h" +#include "gmock/gmock.h" + +using namespace llvm; + +TEST(Demangle, demangleTest) { + EXPECT_EQ(demangle("_Z3fooi"), "foo(int)"); + EXPECT_EQ(demangle("?foo@@YAXH@Z"), "void __cdecl foo(int)"); + EXPECT_EQ(demangle("foo"), "foo"); +} |