]> granicus.if.org Git - clang/commitdiff
Change return type of getObjCEncodingTypeSize() to CharUnits as the units are in...
authorKen Dyck <ken.dyck@onsemi.com>
Mon, 11 Jan 2010 19:19:56 +0000 (19:19 +0000)
committerKen Dyck <ken.dyck@onsemi.com>
Mon, 11 Jan 2010 19:19:56 +0000 (19:19 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93171 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/ASTContext.h
lib/AST/ASTContext.cpp

index 3dcc55fbceaf1a2f0bd8acb50f265b60601fdb36..7dea6dc56f36dd21574acb479bf97f29901afb0e 100644 (file)
@@ -699,8 +699,8 @@ public:
                                       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.
index bd5ca93e1c173d4e708553feb0938430ca799fd9..e729b1b58d55785acee332e1f6845aa31f78d80f 100644 (file)
@@ -3137,7 +3137,7 @@ static bool isTypeTypedefedAsBOOL(QualType T) {
 
 /// 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 @@ int ASTContext::getObjCEncodingTypeSize(QualType type) {
   // 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 @@ void ASTContext::getObjCEncodingForBlock(const BlockExpr *Expr,
   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 @@ void ASTContext::getObjCEncodingForBlock(const BlockExpr *Expr,
       PType = PVDecl->getType();
     getObjCEncodingForType(PType, S);
     S += charUnitsToString(ParmOffset);
-    ParmOffset += CharUnits::fromQuantity(getObjCEncodingTypeSize(PType));
+    ParmOffset += getObjCEncodingTypeSize(PType);
   }
 }
 
@@ -3222,7 +3222,7 @@ void ASTContext::getObjCEncodingForMethodDecl(const ObjCMethodDecl *Decl,
   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 @@ void ASTContext::getObjCEncodingForMethodDecl(const ObjCMethodDecl *Decl,
     getObjCEncodingForTypeQualifier(PVDecl->getObjCDeclQualifier(), S);
     getObjCEncodingForType(PType, S);
     S += charUnitsToString(ParmOffset);
-    ParmOffset += CharUnits::fromQuantity(getObjCEncodingTypeSize(PType));
+    ParmOffset += getObjCEncodingTypeSize(PType);
   }
 }