[cfe-commits] r120491 - /cfe/trunk/lib/CodeGen/CGRecordLayout.h

John McCall rjmccall at apple.com
Tue Nov 30 15:21:46 PST 2010


Author: rjmccall
Date: Tue Nov 30 17:21:46 2010
New Revision: 120491

URL: http://llvm.org/viewvc/llvm-project?rev=120491&view=rev
Log:
A CGRecordLayout object persists.  Since its contained types may
refer to opaque types, they must be held via PATypeHolders.  I'm
not sure why this hasn't blown up before.


Modified:
    cfe/trunk/lib/CodeGen/CGRecordLayout.h

Modified: cfe/trunk/lib/CodeGen/CGRecordLayout.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGRecordLayout.h?rev=120491&r1=120490&r2=120491&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGRecordLayout.h (original)
+++ cfe/trunk/lib/CodeGen/CGRecordLayout.h Tue Nov 30 17:21:46 2010
@@ -11,6 +11,7 @@
 #define CLANG_CODEGEN_CGRECORDLAYOUT_H
 
 #include "llvm/ADT/DenseMap.h"
+#include "llvm/DerivedTypes.h"
 #include "clang/AST/Decl.h"
 namespace llvm {
   class raw_ostream;
@@ -173,11 +174,11 @@
 
 private:
   /// The LLVM type corresponding to this record layout.
-  const llvm::StructType *LLVMType;
+  llvm::PATypeHolder LLVMType;
 
   /// The LLVM type for the non-virtual part of this record layout, used for
   /// laying out the record as a base.
-  const llvm::StructType *NonVirtualBaseLLVMType;
+  llvm::PATypeHolder NonVirtualBaseLLVMType;
 
   /// Map from (non-bit-field) struct field to the corresponding llvm struct
   /// type field no. This info is populated by record builder.
@@ -204,11 +205,11 @@
 
   /// \brief Return the LLVM type associated with this record.
   const llvm::StructType *getLLVMType() const {
-    return LLVMType;
+    return cast<llvm::StructType>(LLVMType.get());
   }
 
   const llvm::StructType *getNonVirtualBaseLLVMType() const {
-      return NonVirtualBaseLLVMType;
+    return cast<llvm::StructType>(NonVirtualBaseLLVMType.get());
   }
 
   /// \brief Check whether this struct can be C++ zero-initialized





More information about the cfe-commits mailing list