From 5981db49a28e71da3c33974b70be6bbcab461bd2 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 15 Jul 2007 23:59:53 +0000 Subject: [PATCH] rename variables to be more consistent. Always use LHS/RHS intead of T1/T2 sometimes. llvm-svn: 39889 --- clang/Sema/SemaExpr.cpp | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/clang/Sema/SemaExpr.cpp b/clang/Sema/SemaExpr.cpp index 8029e822bad4..f86a68303e27 100644 --- a/clang/Sema/SemaExpr.cpp +++ b/clang/Sema/SemaExpr.cpp @@ -279,16 +279,13 @@ Action::ExprResult Sema::ParsePostfixUnaryOp(SourceLocation OpLoc, Action::ExprResult Sema:: ParseArraySubscriptExpr(ExprTy *Base, SourceLocation LLoc, ExprTy *Idx, SourceLocation RLoc) { - Expr *lex = (Expr *)Base; - Expr *rex = (Expr *)Idx; - QualType t1 = lex->getType(); - QualType t2 = rex->getType(); + Expr *LHSExp = static_cast(Base), *RHSExp = static_cast(Idx); + QualType LHSTy = LHSExp->getType(), RHSTy = RHSExp->getType(); + + assert(!LHSTy.isNull() && !RHSTy.isNull() && "missing types"); - assert(!t1.isNull() && "no type for array base expression"); - assert(!t2.isNull() && "no type for array index expression"); - - QualType canonT1 = DefaultFunctionArrayConversion(lex).getCanonicalType(); - QualType canonT2 = DefaultFunctionArrayConversion(rex).getCanonicalType(); + QualType canonT1 = DefaultFunctionArrayConversion(LHSExp).getCanonicalType(); + QualType canonT2 = DefaultFunctionArrayConversion(RHSExp).getCanonicalType(); // C99 6.5.2.1p2: the expression e1[e2] is by definition precisely equivalent // to the expression *((e1)+(e2)). This means the array "Base" may actually be @@ -300,16 +297,16 @@ ParseArraySubscriptExpr(ExprTy *Base, SourceLocation LLoc, if (isa(canonT1) || isa(canonT1)) { baseType = canonT1; indexType = canonT2; - baseExpr = lex; - indexExpr = rex; + baseExpr = LHSExp; + indexExpr = RHSExp; } else if (isa(canonT2)) { // uncommon baseType = canonT2; indexType = canonT1; - baseExpr = rex; - indexExpr = lex; + baseExpr = RHSExp; + indexExpr = LHSExp; } else { - return Diag(lex->getLocStart(), diag::err_typecheck_subscript_value, - rex->getSourceRange()); + return Diag(LHSExp->getLocStart(), diag::err_typecheck_subscript_value, + RHSExp->getSourceRange()); } // C99 6.5.2.1p1 if (!indexType->isIntegerType()) {