[cfe-commits] r117613 - in /cfe/trunk/lib/CodeGen: CGDebugInfo.cpp CGDebugInfo.h

Devang Patel dpatel at apple.com
Thu Oct 28 15:03:20 PDT 2010


Author: dpatel
Date: Thu Oct 28 17:03:20 2010
New Revision: 117613

URL: http://llvm.org/viewvc/llvm-project?rev=117613&view=rev
Log:
Basic types are language defined builtins. They are always defined at top most level.

Modified:
    cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
    cfe/trunk/lib/CodeGen/CGDebugInfo.h

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=117613&r1=117612&r2=117613&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Thu Oct 28 17:03:20 2010
@@ -179,6 +179,12 @@
 
 }
 
+/// 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 @@
   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 @@
   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;
 }
 

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.h?rev=117613&r1=117612&r2=117613&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.h (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.h Thu Oct 28 17:03:20 2010
@@ -218,6 +218,9 @@
   /// 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);





More information about the cfe-commits mailing list