]> granicus.if.org Git - clang/commitdiff
Basic types are language defined builtins. They are always defined at top most level.
authorDevang Patel <dpatel@apple.com>
Thu, 28 Oct 2010 22:03:20 +0000 (22:03 +0000)
committerDevang Patel <dpatel@apple.com>
Thu, 28 Oct 2010 22:03:20 +0000 (22:03 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117613 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGDebugInfo.cpp
lib/CodeGen/CGDebugInfo.h

index 97639db887abca0ed5ae756b5baa9adb6ea8fd2c..46d1447c62c0634e965e75ca9279ccaa5fd62667 100644 (file)
@@ -179,6 +179,12 @@ llvm::DIFile CGDebugInfo::getOrCreateFile(SourceLocation Loc) {
 
 }
 
+/// getOrCreateMainFile - Get the file info for main compile unit.
+llvm::DIFile CGDebugInfo::getOrCreateMainFile() {
+  return DebugFactory.CreateFile(TheCU.getFilename(), TheCU.getDirectory(),
+                                 TheCU);
+}
+
 /// getLineNumber - Get line number for the location. If location is invalid
 /// then use current location.
 unsigned CGDebugInfo::getLineNumber(SourceLocation Loc) {
@@ -340,10 +346,9 @@ llvm::DIType CGDebugInfo::CreateType(const BuiltinType *BT,
   uint64_t Size = CGM.getContext().getTypeSize(BT);
   uint64_t Align = CGM.getContext().getTypeAlign(BT);
   uint64_t Offset = 0;
-  
   llvm::DIType DbgTy = 
-    DebugFactory.CreateBasicType(Unit, BTName,
-                                 Unit, 0, Size, Align,
+    DebugFactory.CreateBasicType(TheCU, BTName, getOrCreateMainFile(),
+                                 0, Size, Align,
                                  Offset, /*flags*/ 0, Encoding);
   return DbgTy;
 }
@@ -360,9 +365,8 @@ llvm::DIType CGDebugInfo::CreateType(const ComplexType *Ty,
   uint64_t Offset = 0;
 
   llvm::DIType DbgTy = 
-    DebugFactory.CreateBasicType(Unit, "complex",
-                                 Unit, 0, Size, Align,
-                                 Offset, /*flags*/ 0, Encoding);
+    DebugFactory.CreateBasicType(TheCU, "complex", getOrCreateMainFile(), 
+                                 0, Size, Align, Offset, /*flags*/ 0, Encoding);
   return DbgTy;
 }
 
index 55e2f0a480aaf072206216b9b8bb31e07dc2bd45..d4beae1c38d5cbf77b7e372a33cc6770ed9ecdc6 100644 (file)
@@ -218,6 +218,9 @@ private:
   /// location.
   llvm::DIFile getOrCreateFile(SourceLocation Loc);
 
+  /// getOrCreateMainFile - Get the file info for main compile unit.
+  llvm::DIFile getOrCreateMainFile();
+
   /// getOrCreateType - Get the type from the cache or create a new type if
   /// necessary.
   llvm::DIType getOrCreateType(QualType Ty, llvm::DIFile F);