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
diff --git a/llvm/tools/llvm-cxxfilt/llvm-cxxfilt.cpp b/llvm/tools/llvm-cxxfilt/llvm-cxxfilt.cpp
index 8be2a6d..13024fb 100644
--- a/llvm/tools/llvm-cxxfilt/llvm-cxxfilt.cpp
+++ b/llvm/tools/llvm-cxxfilt/llvm-cxxfilt.cpp
@@ -68,6 +68,12 @@
(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);