aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/clang/AST/ASTContext.h10
-rw-r--r--lib/AST/ASTContext.cpp10
-rw-r--r--lib/CodeGen/CGDecl.cpp1
3 files changed, 14 insertions, 7 deletions
diff --git a/include/clang/AST/ASTContext.h b/include/clang/AST/ASTContext.h
index 617a019baf..0a9fe2aba1 100644
--- a/include/clang/AST/ASTContext.h
+++ b/include/clang/AST/ASTContext.h
@@ -18,7 +18,6 @@
#include "clang/Basic/LangOptions.h"
#include "clang/Basic/OperatorKinds.h"
#include "clang/AST/Attr.h"
-#include "clang/AST/CharUnits.h"
#include "clang/AST/Decl.h"
#include "clang/AST/NestedNameSpecifier.h"
#include "clang/AST/PrettyPrinter.h"
@@ -39,6 +38,7 @@ namespace clang {
class FileManager;
class ASTRecordLayout;
class BlockExpr;
+ class CharUnits;
class Expr;
class ExternalASTSource;
class IdentifierTable;
@@ -820,12 +820,8 @@ public:
/// getTypeSizeInChars - Return the size of the specified type, in characters.
/// This method does not work on incomplete types.
- CharUnits getTypeSizeInChars(QualType T) {
- return CharUnits::fromRaw(getTypeSize(T) / getCharWidth());
- }
- CharUnits getTypeSizeInChars(const Type *T) {
- return CharUnits::fromRaw(getTypeSize(T) / getCharWidth());
- }
+ CharUnits getTypeSizeInChars(QualType T);
+ CharUnits getTypeSizeInChars(const Type *T);
/// getTypeAlign - Return the ABI-specified alignment of a type, in bits.
/// This method does not work on incomplete types.
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp
index cc7055dc68..0e36a0ad1c 100644
--- a/lib/AST/ASTContext.cpp
+++ b/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/lib/CodeGen/CGDecl.cpp b/lib/CodeGen/CGDecl.cpp
index 72dc8373ca..23af59c2b4 100644
--- a/lib/CodeGen/CGDecl.cpp
+++ b/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"