r178481 - Cleanup. No functional change intended.

Jordan Rose jordan_rose at apple.com
Mon Apr 1 11:10:47 PDT 2013


On Apr 1, 2013, at 10:58 , Chad Rosier <mcrosier at apple.com> 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.

Jordan



More information about the cfe-commits mailing list