Fixed another case where sizeof() returns the size in bytes, not bits.
This parallels a previous patch (duplicate logic caused the bug to appear
in multiple locations):
 
  r44316 (http://llvm.org/viewvc/llvm-project?rev=44316&view=rev).

Patch provided by Nuno Lopes.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45098 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/AST/Expr.cpp b/AST/Expr.cpp
index 9747c47..f4f8900 100644
--- a/AST/Expr.cpp
+++ b/AST/Expr.cpp
@@ -662,10 +662,16 @@
       static_cast<uint32_t>(Ctx.getTypeSize(getType(), Exp->getOperatorLoc())));
     
     // Get information about the size or align.
-    if (Exp->isSizeOf())
-      Result = Ctx.getTypeSize(Exp->getArgumentType(), Exp->getOperatorLoc());
+    if (Exp->isSizeOf()) {
+      unsigned CharSize =
+        Ctx.Target.getCharWidth(Ctx.getFullLoc(Exp->getOperatorLoc()));
+      
+      Result = Ctx.getTypeSize(Exp->getArgumentType(),
+                               Exp->getOperatorLoc()) / CharSize;
+    }
     else
       Result = Ctx.getTypeAlign(Exp->getArgumentType(), Exp->getOperatorLoc());
+    
     break;
   }
   case BinaryOperatorClass: {