rename variables to be more consistent. Always use LHS/RHS intead of T1/T2 sometimes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39889 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2007-07-15 23:59:53 +00:00
Родитель 26dc7b3926
Коммит 727a80dda3
1 изменённых файлов: 12 добавлений и 15 удалений

Просмотреть файл

@ -279,16 +279,13 @@ Action::ExprResult Sema::ParsePostfixUnaryOp(SourceLocation OpLoc,
Action::ExprResult Sema:: Action::ExprResult Sema::
ParseArraySubscriptExpr(ExprTy *Base, SourceLocation LLoc, ParseArraySubscriptExpr(ExprTy *Base, SourceLocation LLoc,
ExprTy *Idx, SourceLocation RLoc) { ExprTy *Idx, SourceLocation RLoc) {
Expr *lex = (Expr *)Base; Expr *LHSExp = static_cast<Expr*>(Base), *RHSExp = static_cast<Expr*>(Idx);
Expr *rex = (Expr *)Idx; QualType LHSTy = LHSExp->getType(), RHSTy = RHSExp->getType();
QualType t1 = lex->getType();
QualType t2 = rex->getType();
assert(!t1.isNull() && "no type for array base expression"); assert(!LHSTy.isNull() && !RHSTy.isNull() && "missing types");
assert(!t2.isNull() && "no type for array index expression");
QualType canonT1 = DefaultFunctionArrayConversion(lex).getCanonicalType(); QualType canonT1 = DefaultFunctionArrayConversion(LHSExp).getCanonicalType();
QualType canonT2 = DefaultFunctionArrayConversion(rex).getCanonicalType(); QualType canonT2 = DefaultFunctionArrayConversion(RHSExp).getCanonicalType();
// C99 6.5.2.1p2: the expression e1[e2] is by definition precisely equivalent // 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 // to the expression *((e1)+(e2)). This means the array "Base" may actually be
@ -300,16 +297,16 @@ ParseArraySubscriptExpr(ExprTy *Base, SourceLocation LLoc,
if (isa<PointerType>(canonT1) || isa<VectorType>(canonT1)) { if (isa<PointerType>(canonT1) || isa<VectorType>(canonT1)) {
baseType = canonT1; baseType = canonT1;
indexType = canonT2; indexType = canonT2;
baseExpr = lex; baseExpr = LHSExp;
indexExpr = rex; indexExpr = RHSExp;
} else if (isa<PointerType>(canonT2)) { // uncommon } else if (isa<PointerType>(canonT2)) { // uncommon
baseType = canonT2; baseType = canonT2;
indexType = canonT1; indexType = canonT1;
baseExpr = rex; baseExpr = RHSExp;
indexExpr = lex; indexExpr = LHSExp;
} else { } else {
return Diag(lex->getLocStart(), diag::err_typecheck_subscript_value, return Diag(LHSExp->getLocStart(), diag::err_typecheck_subscript_value,
rex->getSourceRange()); RHSExp->getSourceRange());
} }
// C99 6.5.2.1p1 // C99 6.5.2.1p1
if (!indexType->isIntegerType()) { if (!indexType->isIntegerType()) {