diff options
author | Ken Dyck <ken.dyck@onsemi.com> | 2009-12-22 14:23:30 +0000 |
---|---|---|
committer | Ken Dyck <ken.dyck@onsemi.com> | 2009-12-22 14:23:30 +0000 |
commit | 8c89d59c82241dbfd6f3f8ebe40041adc7bd841d (patch) | |
tree | 86e25c5418f1c9984323cd842b36350b7f64ca57 /clang/lib | |
parent | 96596c98fbb584d8c9eec99d0a1c0734da756787 (diff) | |
download | bcm5719-llvm-8c89d59c82241dbfd6f3f8ebe40041adc7bd841d.tar.gz bcm5719-llvm-8c89d59c82241dbfd6f3f8ebe40041adc7bd841d.zip |
Move the implementation of ASTContext::getTypeSizeInChars() to the .cpp file to
avoid #including CharUnits.h in ASTContext.h.
llvm-svn: 91903
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/AST/ASTContext.cpp | 10 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGDecl.cpp | 1 |
2 files changed, 11 insertions, 0 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index cc7055dc68b..0e36a0ad1cf 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -12,6 +12,7 @@ //===----------------------------------------------------------------------===// #include "clang/AST/ASTContext.h" +#include "clang/AST/CharUnits.h" #include "clang/AST/DeclCXX.h" #include "clang/AST/DeclObjC.h" #include "clang/AST/DeclTemplate.h" @@ -818,6 +819,15 @@ ASTContext::getTypeInfo(const Type *T) { return std::make_pair(Width, Align); } +/// getTypeSizeInChars - Return the size of the specified type, in characters. +/// This method does not work on incomplete types. +CharUnits ASTContext::getTypeSizeInChars(QualType T) { + return CharUnits::fromRaw(getTypeSize(T) / getCharWidth()); +} +CharUnits ASTContext::getTypeSizeInChars(const Type *T) { + return CharUnits::fromRaw(getTypeSize(T) / getCharWidth()); +} + /// getPreferredTypeAlign - Return the "preferred" alignment of the specified /// type for the current target in bits. This can be different than the ABI /// alignment in cases where it is beneficial for performance to overalign diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp index 72dc8373ca1..23af59c2b42 100644 --- a/clang/lib/CodeGen/CGDecl.cpp +++ b/clang/lib/CodeGen/CGDecl.cpp @@ -15,6 +15,7 @@ #include "CodeGenFunction.h" #include "CodeGenModule.h" #include "clang/AST/ASTContext.h" +#include "clang/AST/CharUnits.h" #include "clang/AST/Decl.h" #include "clang/AST/DeclObjC.h" #include "clang/Basic/SourceManager.h" |