Revert "DI: Fold constant arguments into a single MDString"
[oota-llvm.git] / lib / IR / DebugLoc.cpp
index 718da852fec34ae94ffa29c73808597dfe867f64..e8bdccebae96d5445abd9fd103d61466e14055c5 100644 (file)
@@ -79,8 +79,14 @@ MDNode *DebugLoc::getScopeNode(const LLVMContext &Ctx) const {
 DebugLoc DebugLoc::getFnDebugLoc(const LLVMContext &Ctx) const {
   const MDNode *Scope = getScopeNode(Ctx);
   DISubprogram SP = getDISubprogram(Scope);
-  if (SP.isSubprogram())
-    return DebugLoc::get(SP.getScopeLineNumber(), 0, SP);
+  if (SP.isSubprogram()) {
+    // Check for number of operands since the compatibility is
+    // cheap here.  FIXME: Name the magic constant.
+    if (SP->getNumOperands() > 19)
+      return DebugLoc::get(SP.getScopeLineNumber(), 0, SP);
+    else
+      return DebugLoc::get(SP.getLineNumber(), 0, SP);
+  }
 
   return DebugLoc();
 }