]> granicus.if.org Git - clang/commitdiff
A CGRecordLayout object persists. Since its contained types may
authorJohn McCall <rjmccall@apple.com>
Tue, 30 Nov 2010 23:21:46 +0000 (23:21 +0000)
committerJohn McCall <rjmccall@apple.com>
Tue, 30 Nov 2010 23:21:46 +0000 (23:21 +0000)
refer to opaque types, they must be held via PATypeHolders.  I'm
not sure why this hasn't blown up before.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120491 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGRecordLayout.h

index b7efe5a4eea0010ba9a3f41de4e0a07568d7ab1d..2a7aa3596598e3e5c775ea7a97cdb1315cad94b0 100644 (file)
@@ -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 @@ class CGRecordLayout {
 
 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 @@ public:
 
   /// \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