Make -fstandalone-debug default on mingw

Yaron Keren yaron.keren at gmail.com
Mon Sep 1 11:38:50 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=20741

With the current default, a programmer compiling his program with clang -g
will not get debug info for std::string members and thus the gdb pretty
printer for std::string will fail. That's how I noticed the problem in the
first place. Given that libstdc++ is used in every C++ program and that
std::string is quite popular, this isn't a good result.

This patch makes  -fstandalone-debug default on mingw.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140901/8fb25664/attachment.html>
-------------- next part --------------
Index: C:/my/ceemple/llvm/tools/clang/lib/Frontend/CompilerInvocation.cpp
===================================================================
--- C:/my/ceemple/llvm/tools/clang/lib/Frontend/CompilerInvocation.cpp	(revision 216876)
+++ C:/my/ceemple/llvm/tools/clang/lib/Frontend/CompilerInvocation.cpp	(working copy)
@@ -356,8 +356,11 @@
     bool Default = false;
     // Until dtrace (via CTF) and LLDB can deal with distributed debug info,
     // Darwin and FreeBSD default to standalone/full debug info.
-    if (llvm::Triple(TargetOpts.Triple).isOSDarwin() ||
-        llvm::Triple(TargetOpts.Triple).isOSFreeBSD())
+    // On mingw, without standalone_debug there is no debug info for types
+    // from libstdc++ such as std::string and the gdb pretty printer fails.
+    llvm::Triple TheTriple(TargetOpts.Triple);
+    if (TheTriple.isOSDarwin() || TheTriple.isOSFreeBSD() ||
+        TheTriple.isWindowsGNUEnvironment())
       Default = true;
 
     if (Args.hasFlag(OPT_fstandalone_debug, OPT_fno_standalone_debug, Default))


More information about the cfe-commits mailing list