On Apr 1, 2013, at 11:10 AM, Jordan Rose <[email protected]> wrote: > On Apr 1, 2013, at 10:58 , Chad Rosier <[email protected]> wrote: >> Author: mcrosier >> Date: Mon Apr 1 12:58:03 2013 >> New Revision: 178481 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=178481&view=rev >> Log: >> Cleanup. No functional change intended. >> >> Modified: >> cfe/trunk/lib/Sema/SemaStmtAsm.cpp >> >> Modified: cfe/trunk/lib/Sema/SemaStmtAsm.cpp >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaStmtAsm.cpp?rev=178481&r1=178480&r2=178481&view=diff >> ============================================================================== >> --- cfe/trunk/lib/Sema/SemaStmtAsm.cpp (original) >> +++ cfe/trunk/lib/Sema/SemaStmtAsm.cpp Mon Apr 1 12:58:03 2013 >> @@ -515,21 +515,21 @@ NamedDecl *Sema::LookupInlineAsmIdentifi >> return 0; >> } >> >> - NamedDecl *ND = Result.getFoundDecl(); >> - if (isa<VarDecl>(ND) || isa<FunctionDecl>(ND)) { >> - if (VarDecl *Var = dyn_cast<VarDecl>(ND)) { >> - Type = Context.getTypeInfo(Var->getType()).first; >> - QualType Ty = Var->getType(); >> - 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 /= 8; // Type is in terms of bits, but we want bytes. >> - Size = Length * Type; >> - IsVarDecl = true; >> + NamedDecl *FoundDecl = Result.getFoundDecl(); >> + if (isa<FunctionDecl>(FoundDecl)) >> + return FoundDecl; >> + if (VarDecl *Var = dyn_cast<VarDecl>(FoundDecl)) { >> + Type = Context.getTypeInfo(Var->getType()).first; >> + QualType Ty = Var->getType(); >> + 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. >> } >> - return ND; >> + Type /= 8; // Type is in terms of bits, but we want bytes. > > Just noticed this; please use Context.getCharWidth() instead.
Or better yet, ASTContext.toCharUnitsFromBits, or just call ASTContext.getTypeSizeInChars to begin with. John. _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
