Refactor.
authorDevang Patel <dpatel@apple.com>
Thu, 29 Apr 2010 20:40:36 +0000 (20:40 +0000)
committerDevang Patel <dpatel@apple.com>
Thu, 29 Apr 2010 20:40:36 +0000 (20:40 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102661 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/DebugInfo.cpp
lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp

index 8ba19020b0990878643eee5fbfe39baf496fb788..d33bb6042b285fb6ca36660b7f428a3bb5bb1175 100644 (file)
@@ -402,6 +402,17 @@ uint64_t DIDerivedType::getOriginalTypeSize() const {
   return getSizeInBits();
 }
 
+/// isInlinedFnArgument - Return trule if this variable provides debugging
+/// information for an inlined function arguments.
+bool DIVariable::isInlinedFnArgument(const Function *CurFn) {
+  assert(CurFn && "Invalid function");
+  if (!getContext().isSubprogram())
+    return false;
+  // This variable is not inlined function argument if its scope 
+  // does not describe current function.
+  return !(DISubprogram(getContext().getNode()).describes(CurFn));
+}
+
 /// describes - Return true if this subprogram provides debugging
 /// information for the function F.
 bool DISubprogram::describes(const Function *F) {
index 3f81268c91aca2d1f024615219ce9f0511f308d5..791482906d85ae1b0a04da4b7e8add52c633d530 100644 (file)
@@ -3691,14 +3691,12 @@ SelectionDAGBuilder::EmitFuncArgumentDbgValue(const DbgValueInst &DI,
   if (!isa<Argument>(V))
     return false;
 
+  MachineFunction &MF = DAG.getMachineFunction();
   // Ignore inlined function arguments here.
   DIVariable DV(Variable);
-  if (DV.getContext().isSubprogram()
-      && DISubprogram(DV.getContext().getNode()).getLinkageName()
-      != cast<Argument>(V)->getParent()->getName())
+  if (DV.isInlinedFnArgument(MF.getFunction()))
     return false;
 
-  MachineFunction &MF = DAG.getMachineFunction();
   MachineBasicBlock *MBB = FuncInfo.MBBMap[DI.getParent()];
   if (MBB != &MF.front())
     return false;