reimplement debug info generation in terms of DebugInfo.h instead of
using MachineModuleInfo.  This runs at about the same speed as the old
code, but fixes a bunch of bugs and is simpler and shorter.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58971 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGDecl.cpp b/lib/CodeGen/CGDecl.cpp
index 788beb4..e54c4b3 100644
--- a/lib/CodeGen/CGDecl.cpp
+++ b/lib/CodeGen/CGDecl.cpp
@@ -21,7 +21,6 @@
 #include "clang/Basic/TargetInfo.h"
 #include "llvm/GlobalVariable.h"
 #include "llvm/Type.h"
-#include "llvm/Support/Dwarf.h"
 using namespace clang;
 using namespace CodeGen;
 
@@ -174,11 +173,9 @@
   DMEntry = DeclPtr;
 
   // Emit debug info for local var declaration.
-  CGDebugInfo *DI = CGM.getDebugInfo();
-  if(DI) {
+  if (CGDebugInfo *DI = CGM.getDebugInfo()) {
     DI->setLocation(D.getLocation());
-    DI->EmitDeclare(&D, llvm::dwarf::DW_TAG_auto_variable,
-                    DeclPtr, Builder);
+    DI->EmitDeclareOfAutoVariable(&D, DeclPtr, Builder);
   }
 
   // If this local has an initializer, emit it now.
@@ -231,12 +228,9 @@
   DMEntry = DeclPtr;
 
   // Emit debug info for param declaration.
-  CGDebugInfo *DI = CGM.getDebugInfo();
-  if(DI) {
+  if (CGDebugInfo *DI = CGM.getDebugInfo()) {
     DI->setLocation(D.getLocation());
-    DI->EmitDeclare(&D, llvm::dwarf::DW_TAG_arg_variable,
-                    DeclPtr, Builder);
+    DI->EmitDeclareOfArgVariable(&D, DeclPtr, Builder);
   }
-
 }