Start using DIFile.  See updated SourceLevelDebugging.html for more information.

This patch updates LLVMDebugVersion to 8.
Debug info descriptors encoded using LLVMDebugVersion 7 is supported.

Corresponding llvmgcc and clang FE commits are required.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98020 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/DebugInfo.cpp b/lib/Analysis/DebugInfo.cpp
index 49b2e6b..fda69ac 100644
--- a/lib/Analysis/DebugInfo.cpp
+++ b/lib/Analysis/DebugInfo.cpp
@@ -41,9 +41,9 @@
 
   DIDescriptor DI(N);
 
-  // Check current version. Allow Version6 for now.
+  // Check current version. Allow Version7 for now.
   unsigned Version = DI.getVersion();
-  if (Version != LLVMDebugVersion && Version != LLVMDebugVersion6)
+  if (Version != LLVMDebugVersion && Version != LLVMDebugVersion7)
     return false;
 
   switch (DI.getTag()) {
@@ -698,7 +698,7 @@
 /// CreateBasicType - Create a basic type like int, float, etc.
 DIBasicType DIFactory::CreateBasicType(DIDescriptor Context,
                                        StringRef Name,
-                                       DICompileUnit CompileUnit,
+                                       DIFile F,
                                        unsigned LineNumber,
                                        uint64_t SizeInBits,
                                        uint64_t AlignInBits,
@@ -708,7 +708,7 @@
     GetTagConstant(dwarf::DW_TAG_base_type),
     Context.getNode(),
     MDString::get(VMContext, Name),
-    CompileUnit.getNode(),
+    F.getNode(),
     ConstantInt::get(Type::getInt32Ty(VMContext), LineNumber),
     ConstantInt::get(Type::getInt64Ty(VMContext), SizeInBits),
     ConstantInt::get(Type::getInt64Ty(VMContext), AlignInBits),
@@ -723,7 +723,7 @@
 /// CreateBasicType - Create a basic type like int, float, etc.
 DIBasicType DIFactory::CreateBasicTypeEx(DIDescriptor Context,
                                          StringRef Name,
-                                         DICompileUnit CompileUnit,
+                                         DIFile F,
                                          unsigned LineNumber,
                                          Constant *SizeInBits,
                                          Constant *AlignInBits,
@@ -733,7 +733,7 @@
     GetTagConstant(dwarf::DW_TAG_base_type),
     Context.getNode(),
     MDString::get(VMContext, Name),
-    CompileUnit.getNode(),
+    F.getNode(),
     ConstantInt::get(Type::getInt32Ty(VMContext), LineNumber),
     SizeInBits,
     AlignInBits,
@@ -773,7 +773,7 @@
 DIDerivedType DIFactory::CreateDerivedType(unsigned Tag,
                                            DIDescriptor Context,
                                            StringRef Name,
-                                           DICompileUnit CompileUnit,
+                                           DIFile F,
                                            unsigned LineNumber,
                                            uint64_t SizeInBits,
                                            uint64_t AlignInBits,
@@ -784,7 +784,7 @@
     GetTagConstant(Tag),
     Context.getNode(),
     MDString::get(VMContext, Name),
-    CompileUnit.getNode(),
+    F.getNode(),
     ConstantInt::get(Type::getInt32Ty(VMContext), LineNumber),
     ConstantInt::get(Type::getInt64Ty(VMContext), SizeInBits),
     ConstantInt::get(Type::getInt64Ty(VMContext), AlignInBits),
@@ -801,7 +801,7 @@
 DIDerivedType DIFactory::CreateDerivedTypeEx(unsigned Tag,
                                              DIDescriptor Context,
                                              StringRef Name,
-                                             DICompileUnit CompileUnit,
+                                             DIFile F,
                                              unsigned LineNumber,
                                              Constant *SizeInBits,
                                              Constant *AlignInBits,
@@ -812,7 +812,7 @@
     GetTagConstant(Tag),
     Context.getNode(),
     MDString::get(VMContext, Name),
-    CompileUnit.getNode(),
+    F.getNode(),
     ConstantInt::get(Type::getInt32Ty(VMContext), LineNumber),
     SizeInBits,
     AlignInBits,
@@ -828,7 +828,7 @@
 DICompositeType DIFactory::CreateCompositeType(unsigned Tag,
                                                DIDescriptor Context,
                                                StringRef Name,
-                                               DICompileUnit CompileUnit,
+                                               DIFile F,
                                                unsigned LineNumber,
                                                uint64_t SizeInBits,
                                                uint64_t AlignInBits,
@@ -843,7 +843,7 @@
     GetTagConstant(Tag),
     Context.getNode(),
     MDString::get(VMContext, Name),
-    CompileUnit.getNode(),
+    F.getNode(),
     ConstantInt::get(Type::getInt32Ty(VMContext), LineNumber),
     ConstantInt::get(Type::getInt64Ty(VMContext), SizeInBits),
     ConstantInt::get(Type::getInt64Ty(VMContext), AlignInBits),
@@ -862,7 +862,7 @@
 DICompositeType DIFactory::CreateCompositeTypeEx(unsigned Tag,
                                                  DIDescriptor Context,
                                                  StringRef Name,
-                                                 DICompileUnit CompileUnit,
+                                                 DIFile F,
                                                  unsigned LineNumber,
                                                  Constant *SizeInBits,
                                                  Constant *AlignInBits,
@@ -876,7 +876,7 @@
     GetTagConstant(Tag),
     Context.getNode(),
     MDString::get(VMContext, Name),
-    CompileUnit.getNode(),
+    F.getNode(),
     ConstantInt::get(Type::getInt32Ty(VMContext), LineNumber),
     SizeInBits,
     AlignInBits,
@@ -897,7 +897,7 @@
                                          StringRef Name,
                                          StringRef DisplayName,
                                          StringRef LinkageName,
-                                         DICompileUnit CompileUnit,
+                                         DIFile F,
                                          unsigned LineNo, DIType Ty,
                                          bool isLocalToUnit,
                                          bool isDefinition,
@@ -912,7 +912,7 @@
     MDString::get(VMContext, Name),
     MDString::get(VMContext, DisplayName),
     MDString::get(VMContext, LinkageName),
-    CompileUnit.getNode(),
+    F.getNode(),
     ConstantInt::get(Type::getInt32Ty(VMContext), LineNo),
     Ty.getNode(),
     ConstantInt::get(Type::getInt1Ty(VMContext), isLocalToUnit),
@@ -957,7 +957,7 @@
 DIFactory::CreateGlobalVariable(DIDescriptor Context, StringRef Name,
                                 StringRef DisplayName,
                                 StringRef LinkageName,
-                                DICompileUnit CompileUnit,
+                                DIFile F,
                                 unsigned LineNo, DIType Ty,bool isLocalToUnit,
                                 bool isDefinition, llvm::GlobalVariable *Val) {
   Value *Elts[] = {
@@ -967,7 +967,7 @@
     MDString::get(VMContext, Name),
     MDString::get(VMContext, DisplayName),
     MDString::get(VMContext, LinkageName),
-    CompileUnit.getNode(),
+    F.getNode(),
     ConstantInt::get(Type::getInt32Ty(VMContext), LineNo),
     Ty.getNode(),
     ConstantInt::get(Type::getInt1Ty(VMContext), isLocalToUnit),
@@ -989,13 +989,14 @@
 /// CreateVariable - Create a new descriptor for the specified variable.
 DIVariable DIFactory::CreateVariable(unsigned Tag, DIDescriptor Context,
                                      StringRef Name,
-                                     DICompileUnit CompileUnit, unsigned LineNo,
+                                     DIFile F,
+                                     unsigned LineNo,
                                      DIType Ty) {
   Value *Elts[] = {
     GetTagConstant(Tag),
     Context.getNode(),
     MDString::get(VMContext, Name),
-    CompileUnit.getNode(),
+    F.getNode(),
     ConstantInt::get(Type::getInt32Ty(VMContext), LineNo),
     Ty.getNode(),
   };
@@ -1007,7 +1008,7 @@
 /// which has a complex address expression for its address.
 DIVariable DIFactory::CreateComplexVariable(unsigned Tag, DIDescriptor Context,
                                             const std::string &Name,
-                                            DICompileUnit CompileUnit,
+                                            DIFile F,
                                             unsigned LineNo,
                                             DIType Ty, 
                                             SmallVector<Value *, 9> &addr) {
@@ -1015,7 +1016,7 @@
   Elts.push_back(GetTagConstant(Tag));
   Elts.push_back(Context.getNode());
   Elts.push_back(MDString::get(VMContext, Name));
-  Elts.push_back(CompileUnit.getNode());
+  Elts.push_back(F.getNode());
   Elts.push_back(ConstantInt::get(Type::getInt32Ty(VMContext), LineNo));
   Elts.push_back(Ty.getNode());
   Elts.insert(Elts.end(), addr.begin(), addr.end());
@@ -1040,13 +1041,13 @@
 /// CreateNameSpace - This creates new descriptor for a namespace
 /// with the specified parent context.
 DINameSpace DIFactory::CreateNameSpace(DIDescriptor Context, StringRef Name,
-                                       DICompileUnit CompileUnit, 
+                                       DIFile F,
                                        unsigned LineNo) {
   Value *Elts[] = {
     GetTagConstant(dwarf::DW_TAG_namespace),
     Context.getNode(),
     MDString::get(VMContext, Name),
-    CompileUnit.getNode(),
+    F.getNode(),
     ConstantInt::get(Type::getInt32Ty(VMContext), LineNo)
   };
   return DINameSpace(MDNode::get(VMContext, &Elts[0], 5));