diff options
author | Anders Carlsson <andersca@mac.com> | 2010-11-21 23:56:06 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2010-11-21 23:56:06 +0000 |
commit | e64fbe2a6ca6d79a5de3e1f2bc5e95cd649b3b65 (patch) | |
tree | 44d743d35b97683f9df771d352a0704a1a3c14e1 /clang/lib/CodeGen/CGRecordLayoutBuilder.cpp | |
parent | 37b0736bdc4a8e082be9bef1bed07f92b4f5fe31 (diff) | |
download | bcm5719-llvm-e64fbe2a6ca6d79a5de3e1f2bc5e95cd649b3b65.tar.gz bcm5719-llvm-e64fbe2a6ca6d79a5de3e1f2bc5e95cd649b3b65.zip |
Add getCGRecordLayout helper function. No functionality change.
llvm-svn: 119955
Diffstat (limited to 'clang/lib/CodeGen/CGRecordLayoutBuilder.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGRecordLayoutBuilder.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/clang/lib/CodeGen/CGRecordLayoutBuilder.cpp b/clang/lib/CodeGen/CGRecordLayoutBuilder.cpp index 8ffa0dd7f19..001c3445102 100644 --- a/clang/lib/CodeGen/CGRecordLayoutBuilder.cpp +++ b/clang/lib/CodeGen/CGRecordLayoutBuilder.cpp @@ -140,6 +140,9 @@ private: unsigned getTypeAlignment(const llvm::Type *Ty) const; + /// getCGRecordLayout - Return the CGRecordLayout for the given record. + const CGRecordLayout &getCGRecordLayout(const CXXRecordDecl *RD); + /// CheckZeroInitializable - Check if the given type contains a pointer /// to data member. void CheckZeroInitializable(QualType T); @@ -687,6 +690,15 @@ unsigned CGRecordLayoutBuilder::getTypeAlignment(const llvm::Type *Ty) const { return Types.getTargetData().getABITypeAlignment(Ty); } +const CGRecordLayout & +CGRecordLayoutBuilder::getCGRecordLayout(const CXXRecordDecl *RD) { + // FIXME: It would be better if there was a way to explicitly compute the + // record layout instead of converting to a type. + Types.ConvertTagDeclType(RD); + + return Types.getCGRecordLayout(RD); +} + void CGRecordLayoutBuilder::CheckZeroInitializable(QualType T) { // This record already contains a member pointer. if (!IsZeroInitializable) @@ -712,12 +724,7 @@ void CGRecordLayoutBuilder::CheckZeroInitializable(const CXXRecordDecl *RD) { if (!IsZeroInitializable) return; - // FIXME: It would be better if there was a way to explicitly compute the - // record layout instead of converting to a type. - Types.ConvertTagDeclType(RD); - - const CGRecordLayout &Layout = Types.getCGRecordLayout(RD); - + const CGRecordLayout &Layout = getCGRecordLayout(RD); if (!Layout.isZeroInitializable()) IsZeroInitializable = false; } |