Added -g command line options to clang for generating source level debug information. This patch currently enables generation of line number debug information (stoppoints) and region begin/end debug information. The new files CGDebugInfo.h and CGDebugInfo.cpp implements the debug info manager class CGDebugInfo.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50848 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Driver/clang.cpp b/Driver/clang.cpp
index d3c40dc..c6ace84 100644
--- a/Driver/clang.cpp
+++ b/Driver/clang.cpp
@@ -149,6 +149,13 @@
  llvm::cl::desc("Specify output file (for --serialize, this is a directory)"));
 
 //===----------------------------------------------------------------------===//
+// Code Generator Options
+//===----------------------------------------------------------------------===//
+static llvm::cl::opt<bool>
+GenerateDebugInfo("g",
+                  llvm::cl::desc("Generate source level debug information"));
+
+//===----------------------------------------------------------------------===//
 // Diagnostic Options
 //===----------------------------------------------------------------------===//
 
@@ -1161,7 +1168,7 @@
     case EmitLLVM:
     case EmitBC:
       DestModule = new llvm::Module(InFile);
-      return CreateLLVMCodeGen(Diag, LangOpts, DestModule);
+      return CreateLLVMCodeGen(Diag, LangOpts, DestModule, GenerateDebugInfo);
 
     case SerializeAST:
       // FIXME: Allow user to tailor where the file is written.