Don't use __cxa_demangle under MSVC (which doesn't have it)
authorAlexander Potapenko <glider@google.com>
Mon, 12 Nov 2012 14:49:58 +0000 (14:49 +0000)
committerAlexander Potapenko <glider@google.com>
Mon, 12 Nov 2012 14:49:58 +0000 (14:49 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167730 91177308-0d34-0410-b5e6-96231b3b80d8

tools/llvm-symbolizer/llvm-symbolizer.cpp

index 79bdcedd3b644f8dbd11a3db24ec714f944f3ca6..f3e365981e4d1f188f099216d9e91283613fc2f8 100644 (file)
@@ -287,9 +287,11 @@ static ModuleInfo *getOrCreateModuleInfo(const std::string &ModuleName) {
   return Info;
 }
 
-// Assume that __cxa_demangle is provided by libcxxabi.
+#if !defined(_MSC_VER)
+// Assume that __cxa_demangle is provided by libcxxabi (except for Windows).
 extern "C" char *__cxa_demangle(const char *mangled_name, char *output_buffer,
                                 size_t *length, int *status);
+#endif
 
 static void printDILineInfo(DILineInfo LineInfo) {
   // By default, DILineInfo contains "<invalid>" for function/filename it
@@ -300,6 +302,7 @@ static void printDILineInfo(DILineInfo LineInfo) {
     std::string FunctionName = LineInfo.getFunctionName();
     if (FunctionName == kDILineInfoBadString)
       FunctionName = kSymbolizerBadString;
+#if !defined(_MSC_VER)
     if (Demangle) {
       int status = 0;
       char *DemangledName = __cxa_demangle(
@@ -309,6 +312,7 @@ static void printDILineInfo(DILineInfo LineInfo) {
         free(DemangledName);
       }
     }
+#endif
     outs() << FunctionName << "\n";
   }
   std::string Filename = LineInfo.getFileName();