[llvm] r298550 - c++filt: support COFF import thunks

Saleem Abdulrasool via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 22 14:15:19 PDT 2017


Author: compnerd
Date: Wed Mar 22 16:15:19 2017
New Revision: 298550

URL: http://llvm.org/viewvc/llvm-project?rev=298550&view=rev
Log:
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.

Added:
    llvm/trunk/test/tools/llvm-cxxfilt/coff-import.test
Modified:
    llvm/trunk/tools/llvm-cxxfilt/llvm-cxxfilt.cpp

Added: llvm/trunk/test/tools/llvm-cxxfilt/coff-import.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-cxxfilt/coff-import.test?rev=298550&view=auto
==============================================================================
--- llvm/trunk/test/tools/llvm-cxxfilt/coff-import.test (added)
+++ llvm/trunk/test/tools/llvm-cxxfilt/coff-import.test Wed Mar 22 16:15:19 2017
@@ -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>
+

Modified: llvm/trunk/tools/llvm-cxxfilt/llvm-cxxfilt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-cxxfilt/llvm-cxxfilt.cpp?rev=298550&r1=298549&r2=298550&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-cxxfilt/llvm-cxxfilt.cpp (original)
+++ llvm/trunk/tools/llvm-cxxfilt/llvm-cxxfilt.cpp Wed Mar 22 16:15:19 2017
@@ -68,6 +68,12 @@ static void demangle(llvm::raw_ostream &
                 (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);




More information about the llvm-commits mailing list