[cfe-commits] r93171 - in /cfe/trunk: include/clang/AST/ASTContext.h lib/AST/ASTContext.cpp
Ken Dyck
ken.dyck at onsemi.com
Mon Jan 11 11:19:57 PST 2010
Author: kjdyck
Date: Mon Jan 11 13:19:56 2010
New Revision: 93171
URL: http://llvm.org/viewvc/llvm-project?rev=93171&view=rev
Log:
Change return type of getObjCEncodingTypeSize() to CharUnits as the units are in characters.
Modified:
cfe/trunk/include/clang/AST/ASTContext.h
cfe/trunk/lib/AST/ASTContext.cpp
Modified: cfe/trunk/include/clang/AST/ASTContext.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTContext.h?rev=93171&r1=93170&r2=93171&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/ASTContext.h (original)
+++ cfe/trunk/include/clang/AST/ASTContext.h Mon Jan 11 13:19:56 2010
@@ -699,8 +699,8 @@
ObjCProtocolDecl *rProto);
/// getObjCEncodingTypeSize returns size of type for objective-c encoding
- /// purpose.
- int getObjCEncodingTypeSize(QualType t);
+ /// purpose in characters.
+ CharUnits getObjCEncodingTypeSize(QualType t);
/// This setter/getter represents the ObjC 'id' type. It is setup lazily, by
/// Sema. id is always a (typedef for a) pointer type, a pointer to a struct.
Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=93171&r1=93170&r2=93171&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Mon Jan 11 13:19:56 2010
@@ -3137,7 +3137,7 @@
/// getObjCEncodingTypeSize returns size of type for objective-c encoding
/// purpose.
-int ASTContext::getObjCEncodingTypeSize(QualType type) {
+CharUnits ASTContext::getObjCEncodingTypeSize(QualType type) {
CharUnits sz = getTypeSizeInChars(type);
// Make all integer and enum types at least as large as an int
@@ -3146,7 +3146,7 @@
// Treat arrays as pointers, since that's how they're passed in.
else if (type->isArrayType())
sz = getTypeSizeInChars(VoidPtrTy);
- return sz.getQuantity();
+ return sz;
}
static inline
@@ -3172,7 +3172,7 @@
for (ObjCMethodDecl::param_iterator PI = Decl->param_begin(),
E = Decl->param_end(); PI != E; ++PI) {
QualType PType = (*PI)->getType();
- CharUnits sz = CharUnits::fromQuantity(getObjCEncodingTypeSize(PType));
+ CharUnits sz = getObjCEncodingTypeSize(PType);
assert (sz.isPositive() && "BlockExpr - Incomplete param type");
ParmOffset += sz;
}
@@ -3198,7 +3198,7 @@
PType = PVDecl->getType();
getObjCEncodingForType(PType, S);
S += charUnitsToString(ParmOffset);
- ParmOffset += CharUnits::fromQuantity(getObjCEncodingTypeSize(PType));
+ ParmOffset += getObjCEncodingTypeSize(PType);
}
}
@@ -3222,7 +3222,7 @@
for (ObjCMethodDecl::param_iterator PI = Decl->param_begin(),
E = Decl->param_end(); PI != E; ++PI) {
QualType PType = (*PI)->getType();
- CharUnits sz = CharUnits::fromQuantity(getObjCEncodingTypeSize(PType));
+ CharUnits sz = getObjCEncodingTypeSize(PType);
assert (sz.isPositive() &&
"getObjCEncodingForMethodDecl - Incomplete param type");
ParmOffset += sz;
@@ -3250,7 +3250,7 @@
getObjCEncodingForTypeQualifier(PVDecl->getObjCDeclQualifier(), S);
getObjCEncodingForType(PType, S);
S += charUnitsToString(ParmOffset);
- ParmOffset += CharUnits::fromQuantity(getObjCEncodingTypeSize(PType));
+ ParmOffset += getObjCEncodingTypeSize(PType);
}
}
More information about the cfe-commits
mailing list