diff --git a/lib/Sema/SemaStmtAsm.cpp b/lib/Sema/SemaStmtAsm.cpp index 6b13f71c3a..da33bdf717 100644 --- a/lib/Sema/SemaStmtAsm.cpp +++ b/lib/Sema/SemaStmtAsm.cpp @@ -519,15 +519,13 @@ NamedDecl *Sema::LookupInlineAsmIdentifier(StringRef Name, SourceLocation Loc, if (isa(FoundDecl)) return FoundDecl; if (VarDecl *Var = dyn_cast(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; }