Constify methods and reuse RecordOrganizer object.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43284 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/CodeGen/CodeGenTypes.h b/CodeGen/CodeGenTypes.h
index 7ab3afe..f2f1bf3 100644
--- a/CodeGen/CodeGenTypes.h
+++ b/CodeGen/CodeGenTypes.h
@@ -58,10 +58,12 @@
/// getLLVMType - Return associated llvm struct type. This may be NULL
/// if fields are not laid out.
- llvm::Type *getLLVMType() {
+ llvm::Type *getLLVMType() const {
return STy;
}
+ /// Clear private data so that this object can be reused.
+ void clear();
private:
llvm::Type *STy;
llvm::SmallVector<const FieldDecl *, 8> FieldDecls;
@@ -75,7 +77,7 @@
RecordLayoutInfo(RecordOrganizer *RO);
/// getLLVMType - Return llvm type associated with this record.
- llvm::Type *getLLVMType() {
+ llvm::Type *getLLVMType() const {
return STy;
}
@@ -117,7 +119,7 @@
void DecodeArgumentTypes(const FunctionTypeProto &FTP,
std::vector<const llvm::Type*> &ArgTys);
- RecordLayoutInfo *getRecordLayoutInfo(const llvm::Type*);
+ const RecordLayoutInfo *getRecordLayoutInfo(const llvm::Type*) const;
/// getLLVMFieldNo - Return llvm::StructType element number
/// that corresponds to the field FD.