]> granicus.if.org Git - llvm/commitdiff
c++filt: support COFF import thunks
authorSaleem Abdulrasool <compnerd@compnerd.org>
Wed, 22 Mar 2017 21:15:19 +0000 (21:15 +0000)
committerSaleem Abdulrasool <compnerd@compnerd.org>
Wed, 22 Mar 2017 21:15:19 +0000 (21:15 +0000)
The synthetic thunk for the import is prefixed with __imp_.  Attempt to
undecorate the names when they begin with the __imp_ prefix.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298550 91177308-0d34-0410-b5e6-96231b3b80d8

test/tools/llvm-cxxfilt/coff-import.test [new file with mode: 0644]
tools/llvm-cxxfilt/llvm-cxxfilt.cpp

diff --git a/test/tools/llvm-cxxfilt/coff-import.test b/test/tools/llvm-cxxfilt/coff-import.test
new file mode 100644 (file)
index 0000000..35494d7
--- /dev/null
@@ -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>
+
index 8be2a6d3b456e5a59658ead325d536d25ed9a5d1..13024fbeaeaa09dae3cfd2c163ff73404f89f60b 100644 (file)
@@ -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);