Use the ASYContext::getTypeSizeInChars API to cleanup some ugliness, per John

and Jordan's suggestion.  No functional change intendend.

llvm-svn: 178507
This commit is contained in:
Chad Rosier 2013-04-01 22:02:05 +00:00
parent 9423f507b1
commit c3aa20265a
1 changed files with 3 additions and 5 deletions

View 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;
}