Start using DIFile. Corresponding llvm patch is r98020.

llvm-svn: 98021
diff --git a/clang/lib/CodeGen/CGDebugInfo.h b/clang/lib/CodeGen/CGDebugInfo.h
index 50f57594..f71f362 100644
--- a/clang/lib/CodeGen/CGDebugInfo.h
+++ b/clang/lib/CodeGen/CGDebugInfo.h
@@ -43,16 +43,14 @@
 /// the backend.
 class CGDebugInfo {
   CodeGenModule &CGM;
-  bool isMainCompileUnitCreated;
   llvm::DIFactory DebugFactory;
+  llvm::DICompileUnit TheCU;
 
   SourceLocation CurLoc, PrevLoc;
   
   llvm::DIType VTablePtrType;
 
-  /// CompileUnitCache - Cache of previously constructed CompileUnits.
-  llvm::DenseMap<unsigned, llvm::DICompileUnit> CompileUnitCache;
-
+  
   /// TypeCache - Cache of previously constructed Types.
   // FIXME: Eliminate this map.  Be careful of iterator invalidation.
   std::map<void *, llvm::WeakVH> TypeCache;
@@ -71,52 +69,52 @@
   llvm::DenseMap<const NamespaceDecl *, llvm::WeakVH> NameSpaceCache;
 
   /// Helper functions for getOrCreateType.
-  llvm::DIType CreateType(const BuiltinType *Ty, llvm::DICompileUnit U);
-  llvm::DIType CreateType(const ComplexType *Ty, llvm::DICompileUnit U);
-  llvm::DIType CreateQualifiedType(QualType Ty, llvm::DICompileUnit U);
-  llvm::DIType CreateType(const TypedefType *Ty, llvm::DICompileUnit U);
+  llvm::DIType CreateType(const BuiltinType *Ty, llvm::DIFile F);
+  llvm::DIType CreateType(const ComplexType *Ty, llvm::DIFile F);
+  llvm::DIType CreateQualifiedType(QualType Ty, llvm::DIFile F);
+  llvm::DIType CreateType(const TypedefType *Ty, llvm::DIFile F);
   llvm::DIType CreateType(const ObjCObjectPointerType *Ty,
-                          llvm::DICompileUnit Unit);
-  llvm::DIType CreateType(const PointerType *Ty, llvm::DICompileUnit U);
-  llvm::DIType CreateType(const BlockPointerType *Ty, llvm::DICompileUnit U);
-  llvm::DIType CreateType(const FunctionType *Ty, llvm::DICompileUnit U);
-  llvm::DIType CreateType(const TagType *Ty, llvm::DICompileUnit U);
-  llvm::DIType CreateType(const RecordType *Ty, llvm::DICompileUnit U);
-  llvm::DIType CreateType(const ObjCInterfaceType *Ty, llvm::DICompileUnit U);
-  llvm::DIType CreateType(const EnumType *Ty, llvm::DICompileUnit U);
-  llvm::DIType CreateType(const VectorType *Ty, llvm::DICompileUnit Unit);
-  llvm::DIType CreateType(const ArrayType *Ty, llvm::DICompileUnit U);
-  llvm::DIType CreateType(const LValueReferenceType *Ty, llvm::DICompileUnit U);
-  llvm::DIType CreateType(const MemberPointerType *Ty, llvm::DICompileUnit U);
+                          llvm::DIFile F);
+  llvm::DIType CreateType(const PointerType *Ty, llvm::DIFile F);
+  llvm::DIType CreateType(const BlockPointerType *Ty, llvm::DIFile F);
+  llvm::DIType CreateType(const FunctionType *Ty, llvm::DIFile F);
+  llvm::DIType CreateType(const TagType *Ty, llvm::DIFile F);
+  llvm::DIType CreateType(const RecordType *Ty, llvm::DIFile F);
+  llvm::DIType CreateType(const ObjCInterfaceType *Ty, llvm::DIFile F);
+  llvm::DIType CreateType(const EnumType *Ty, llvm::DIFile F);
+  llvm::DIType CreateType(const VectorType *Ty, llvm::DIFile F);
+  llvm::DIType CreateType(const ArrayType *Ty, llvm::DIFile F);
+  llvm::DIType CreateType(const LValueReferenceType *Ty, llvm::DIFile F);
+  llvm::DIType CreateType(const MemberPointerType *Ty, llvm::DIFile F);
   llvm::DIType getOrCreateMethodType(const CXXMethodDecl *Method,
-                                     llvm::DICompileUnit Unit);
-  llvm::DIType getOrCreateVTablePtrType(llvm::DICompileUnit Unit);
+                                     llvm::DIFile F);
+  llvm::DIType getOrCreateVTablePtrType(llvm::DIFile F);
   llvm::DINameSpace getOrCreateNameSpace(const NamespaceDecl *N, 
                                          llvm::DIDescriptor Unit);
 
   llvm::DIType CreatePointerLikeType(unsigned Tag,
                                      const Type *Ty, QualType PointeeTy,
-                                     llvm::DICompileUnit U);
+                                     llvm::DIFile F);
   
   llvm::DISubprogram CreateCXXMemberFunction(const CXXMethodDecl *Method,
-                                             llvm::DICompileUnit Unit,
+                                             llvm::DIFile F,
                                              llvm::DICompositeType &RecordTy);
   
   void CollectCXXMemberFunctions(const CXXRecordDecl *Decl,
-                                 llvm::DICompileUnit U,
+                                 llvm::DIFile F,
                                  llvm::SmallVectorImpl<llvm::DIDescriptor> &E,
                                  llvm::DICompositeType &T);
   void CollectCXXBases(const CXXRecordDecl *Decl,
-                       llvm::DICompileUnit Unit,
+                       llvm::DIFile F,
                        llvm::SmallVectorImpl<llvm::DIDescriptor> &EltTys,
                        llvm::DICompositeType &RecordTy);
 
 
-  void CollectRecordFields(const RecordDecl *Decl, llvm::DICompileUnit U,
+  void CollectRecordFields(const RecordDecl *Decl, llvm::DIFile F,
                            llvm::SmallVectorImpl<llvm::DIDescriptor> &E);
 
   void CollectVtableInfo(const CXXRecordDecl *Decl,
-                         llvm::DICompileUnit Unit,
+                         llvm::DIFile F,
                          llvm::SmallVectorImpl<llvm::DIDescriptor> &EltTys);
 
 public:
@@ -185,16 +183,19 @@
   llvm::DIDescriptor getContextDescriptor(const Decl *Decl,
                                           llvm::DIDescriptor &CU);
 
-  /// getOrCreateCompileUnit - Get the compile unit from the cache or create a
-  /// new one if necessary.
-  llvm::DICompileUnit getOrCreateCompileUnit(SourceLocation Loc);
+  /// CreateCompileUnit - Create new compile unit.
+  void CreateCompileUnit();
+
+  /// getOrCreateFile - Get the file debug info descriptor for the input 
+  /// location.
+  llvm::DIFile getOrCreateFile(SourceLocation Loc);
 
   /// getOrCreateType - Get the type from the cache or create a new type if
   /// necessary.
-  llvm::DIType getOrCreateType(QualType Ty, llvm::DICompileUnit Unit);
+  llvm::DIType getOrCreateType(QualType Ty, llvm::DIFile F);
 
   /// CreateTypeNode - Create type metadata for a source language type.
-  llvm::DIType CreateTypeNode(QualType Ty, llvm::DICompileUnit Unit);
+  llvm::DIType CreateTypeNode(QualType Ty, llvm::DIFile F);
 
   /// getFunctionName - Get function name for the given FunctionDecl. If the
   /// name is constructred on demand (e.g. C++ destructor) then the name