]> granicus.if.org Git - clang/commitdiff
Use the ASYContext::getTypeSizeInChars API to cleanup some ugliness, per John
authorChad Rosier <mcrosier@apple.com>
Mon, 1 Apr 2013 22:02:05 +0000 (22:02 +0000)
committerChad Rosier <mcrosier@apple.com>
Mon, 1 Apr 2013 22:02:05 +0000 (22:02 +0000)
and Jordan's suggestion.  No functional change intendend.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178507 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaStmtAsm.cpp

index 6b13f71c3aed563c306a5516112804ed15d90cdc..da33bdf717e6d447d21437c84f2bc894b1234f6f 100644 (file)
@@ -519,15 +519,13 @@ NamedDecl *Sema::LookupInlineAsmIdentifier(StringRef Name, SourceLocation Loc,
   if (isa<FunctionDecl>(FoundDecl))
     return FoundDecl;
   if (VarDecl *Var = dyn_cast<VarDecl>(FoundDecl)) {
-    Type = Context.getTypeInfo(Var->getType()).first;
     QualType Ty = Var->getType();
+    Type = Size = Context.getTypeSizeInChars(Ty).getQuantity();
     if (Ty->isArrayType()) {
       const ArrayType *ATy = Context.getAsArrayType(Ty);
-      Length = Type / Context.getTypeInfo(ATy->getElementType()).first;
-      Type /= Length; // Type is in terms of a single element.
+      Type = Context.getTypeSizeInChars(ATy->getElementType()).getQuantity();
+      Length = Size / Type;
     }
-    Type /= 8; // Type is in terms of bits, but we want bytes.
-    Size = Length * Type;
     IsVarDecl = true;
     return FoundDecl;
   }