Revert "Revert r189902 as the workaround shouldn't be necessary anymore."
authorEric Christopher <echristo@gmail.com>
Wed, 4 Sep 2013 21:36:52 +0000 (21:36 +0000)
committerEric Christopher <echristo@gmail.com>
Wed, 4 Sep 2013 21:36:52 +0000 (21:36 +0000)
Needs testcase updates.

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

lib/CodeGen/AsmPrinter/DwarfDebug.cpp

index 535b094f1682be8ee4fbdae65c0625d29f6e8f37..6835f40cd8e0f11f7ac772f62dc0e7ee10d813ad 100644 (file)
@@ -161,8 +161,12 @@ DIType DbgVariable::getType() const {
 /// Return Dwarf Version by checking module flags.
 static unsigned getDwarfVersionFromModule(const Module *M) {
   Value *Val = M->getModuleFlag("Dwarf Version");
+  // If we don't have a value in the module go ahead and use the default in
+  // dwarf::DWARF_VERSION.
+  // FIXME: Apple ld has a problem parsing compilation units that specify a
+  // dwarf version of greater than 3.
   if (!Val)
-    return dwarf::DWARF_VERSION;
+    return Triple(M->getTargetTriple()).isOSDarwin() ? 3 : dwarf::DWARF_VERSION;
   return cast<ConstantInt>(Val)->getZExtValue();
 }