summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSaleem Abdulrasool <compnerd@compnerd.org>2017-03-22 21:15:19 +0000
committerSaleem Abdulrasool <compnerd@compnerd.org>2017-03-22 21:15:19 +0000
commit1723b8bbbc14c3e1c58613e1badd46d2243de2ab (patch)
treefc2bbb48f46540818b10f9f8b60932c01a120b7e
parent7121c00966cb5ea724e7d13db02afc1e885cd2f8 (diff)
downloadbcm5719-llvm-1723b8bbbc14c3e1c58613e1badd46d2243de2ab.tar.gz
bcm5719-llvm-1723b8bbbc14c3e1c58613e1badd46d2243de2ab.zip
c++filt: support COFF import thunks
The synthetic thunk for the import is prefixed with __imp_. Attempt to undecorate the names when they begin with the __imp_ prefix. llvm-svn: 298550
-rw-r--r--llvm/test/tools/llvm-cxxfilt/coff-import.test5
-rw-r--r--llvm/tools/llvm-cxxfilt/llvm-cxxfilt.cpp6
2 files changed, 11 insertions, 0 deletions
diff --git a/llvm/test/tools/llvm-cxxfilt/coff-import.test b/llvm/test/tools/llvm-cxxfilt/coff-import.test
new file mode 100644
index 00000000000..35494d7a832
--- /dev/null
+++ b/llvm/test/tools/llvm-cxxfilt/coff-import.test
@@ -0,0 +1,5 @@
+RUN: llvm-cxxfilt -_ ___imp__ZSt6futureIvE | FileCheck %s
+RUN: llvm-cxxfilt __imp__ZSt6futureIvE | FileCheck %s
+
+CHECK: import thunk for std::future<void>
+
diff --git a/llvm/tools/llvm-cxxfilt/llvm-cxxfilt.cpp b/llvm/tools/llvm-cxxfilt/llvm-cxxfilt.cpp
index 8be2a6d3b45..13024fbeaea 100644
--- a/llvm/tools/llvm-cxxfilt/llvm-cxxfilt.cpp
+++ b/llvm/tools/llvm-cxxfilt/llvm-cxxfilt.cpp
@@ -68,6 +68,12 @@ static void demangle(llvm::raw_ostream &OS, const std::string &Mangled) {
(DecoratedLength >= 4 && strncmp(Decorated, "___Z", 4) == 0)))
Undecorated = itaniumDemangle(Decorated, nullptr, nullptr, &Status);
+ if (!Undecorated &&
+ (DecoratedLength > 6 && strncmp(Decorated, "__imp_", 6) == 0)) {
+ OS << "import thunk for ";
+ Undecorated = itaniumDemangle(Decorated + 6, nullptr, nullptr, &Status);
+ }
+
OS << (Undecorated ? Undecorated : Mangled) << '\n';
free(Undecorated);
OpenPOWER on IntegriCloud