Rename variables in SemaExpr.cpp to give a more consistant naming scheme.

ExprResult LHS, RHS,
Expr *LHSExpr, *RHSExpr
QualType LHSType, RHSType

Functions changed:
DiagnoseConditionalForNull()
CheckConditionalOperands()
IsArithmeticBinaryExpr()
DiagnoseConditionalPrecedence()

llvm-svn: 139167
This commit is contained in:
Richard Trieu 2011-09-06 20:06:39 +00:00
parent 1d6bad0b47
commit d33e46e943
1 changed files with 21 additions and 20 deletions

View File

@ -4371,17 +4371,17 @@ ExprResult Sema::ActOnParenOrParenListExpr(SourceLocation L,
/// \brief Emit a specialized diagnostic when one expression is a null pointer /// \brief Emit a specialized diagnostic when one expression is a null pointer
/// constant and the other is not a pointer. Returns true if a diagnostic is /// constant and the other is not a pointer. Returns true if a diagnostic is
/// emitted. /// emitted.
bool Sema::DiagnoseConditionalForNull(Expr *LHS, Expr *RHS, bool Sema::DiagnoseConditionalForNull(Expr *LHSExpr, Expr *RHSExpr,
SourceLocation QuestionLoc) { SourceLocation QuestionLoc) {
Expr *NullExpr = LHS; Expr *NullExpr = LHSExpr;
Expr *NonPointerExpr = RHS; Expr *NonPointerExpr = RHSExpr;
Expr::NullPointerConstantKind NullKind = Expr::NullPointerConstantKind NullKind =
NullExpr->isNullPointerConstant(Context, NullExpr->isNullPointerConstant(Context,
Expr::NPC_ValueDependentIsNotNull); Expr::NPC_ValueDependentIsNotNull);
if (NullKind == Expr::NPCK_NotNull) { if (NullKind == Expr::NPCK_NotNull) {
NullExpr = RHS; NullExpr = RHSExpr;
NonPointerExpr = LHS; NonPointerExpr = LHSExpr;
NullKind = NullKind =
NullExpr->isNullPointerConstant(Context, NullExpr->isNullPointerConstant(Context,
Expr::NPC_ValueDependentIsNotNull); Expr::NPC_ValueDependentIsNotNull);
@ -4613,21 +4613,21 @@ static bool checkPointerIntegerMismatch(Sema &S, ExprResult &Int,
return true; return true;
} }
/// Note that lhs is not null here, even if this is the gnu "x ?: y" extension. /// Note that LHS is not null here, even if this is the gnu "x ?: y" extension.
/// In that case, lhs = cond. /// In that case, LHS = cond.
/// C99 6.5.15 /// C99 6.5.15
QualType Sema::CheckConditionalOperands(ExprResult &Cond, ExprResult &LHS, QualType Sema::CheckConditionalOperands(ExprResult &Cond, ExprResult &LHS,
ExprResult &RHS, ExprValueKind &VK, ExprResult &RHS, ExprValueKind &VK,
ExprObjectKind &OK, ExprObjectKind &OK,
SourceLocation QuestionLoc) { SourceLocation QuestionLoc) {
ExprResult lhsResult = CheckPlaceholderExpr(LHS.get()); ExprResult LHSResult = CheckPlaceholderExpr(LHS.get());
if (!lhsResult.isUsable()) return QualType(); if (!LHSResult.isUsable()) return QualType();
LHS = move(lhsResult); LHS = move(LHSResult);
ExprResult rhsResult = CheckPlaceholderExpr(RHS.get()); ExprResult RHSResult = CheckPlaceholderExpr(RHS.get());
if (!rhsResult.isUsable()) return QualType(); if (!RHSResult.isUsable()) return QualType();
RHS = move(rhsResult); RHS = move(RHSResult);
// C++ is sufficiently different to merit its own checker. // C++ is sufficiently different to merit its own checker.
if (getLangOptions().CPlusPlus) if (getLangOptions().CPlusPlus)
@ -4885,9 +4885,10 @@ static bool IsArithmeticOp(BinaryOperatorKind Opc) {
/// IsArithmeticBinaryExpr - Returns true if E is an arithmetic binary /// IsArithmeticBinaryExpr - Returns true if E is an arithmetic binary
/// expression, either using a built-in or overloaded operator, /// expression, either using a built-in or overloaded operator,
/// and sets *OpCode to the opcode and *RHS to the right-hand side expression. /// and sets *OpCode to the opcode and *RHSExprs to the right-hand side
/// expression.
static bool IsArithmeticBinaryExpr(Expr *E, BinaryOperatorKind *Opcode, static bool IsArithmeticBinaryExpr(Expr *E, BinaryOperatorKind *Opcode,
Expr **RHS) { Expr **RHSExprs) {
E = E->IgnoreParenImpCasts(); E = E->IgnoreParenImpCasts();
E = E->IgnoreConversionOperator(); E = E->IgnoreConversionOperator();
E = E->IgnoreParenImpCasts(); E = E->IgnoreParenImpCasts();
@ -4896,7 +4897,7 @@ static bool IsArithmeticBinaryExpr(Expr *E, BinaryOperatorKind *Opcode,
if (BinaryOperator *OP = dyn_cast<BinaryOperator>(E)) { if (BinaryOperator *OP = dyn_cast<BinaryOperator>(E)) {
if (IsArithmeticOp(OP->getOpcode())) { if (IsArithmeticOp(OP->getOpcode())) {
*Opcode = OP->getOpcode(); *Opcode = OP->getOpcode();
*RHS = OP->getRHS(); *RHSExprs = OP->getRHS();
return true; return true;
} }
} }
@ -4915,7 +4916,7 @@ static bool IsArithmeticBinaryExpr(Expr *E, BinaryOperatorKind *Opcode,
BinaryOperatorKind OpKind = BinaryOperator::getOverloadedOpcode(OO); BinaryOperatorKind OpKind = BinaryOperator::getOverloadedOpcode(OO);
if (IsArithmeticOp(OpKind)) { if (IsArithmeticOp(OpKind)) {
*Opcode = OpKind; *Opcode = OpKind;
*RHS = Call->getArg(1); *RHSExprs = Call->getArg(1);
return true; return true;
} }
} }
@ -4950,8 +4951,8 @@ static bool ExprLooksBoolean(Expr *E) {
static void DiagnoseConditionalPrecedence(Sema &Self, static void DiagnoseConditionalPrecedence(Sema &Self,
SourceLocation OpLoc, SourceLocation OpLoc,
Expr *Condition, Expr *Condition,
Expr *LHS, Expr *LHSExpr,
Expr *RHS) { Expr *RHSExpr) {
BinaryOperatorKind CondOpcode; BinaryOperatorKind CondOpcode;
Expr *CondRHS; Expr *CondRHS;
@ -4974,7 +4975,7 @@ static void DiagnoseConditionalPrecedence(Sema &Self,
SuggestParentheses(Self, OpLoc, SuggestParentheses(Self, OpLoc,
Self.PDiag(diag::note_precedence_conditional_first), Self.PDiag(diag::note_precedence_conditional_first),
SourceRange(CondRHS->getLocStart(), RHS->getLocEnd())); SourceRange(CondRHS->getLocStart(), RHSExpr->getLocEnd()));
} }
/// ActOnConditionalOp - Parse a ?: operation. Note that 'LHS' may be null /// ActOnConditionalOp - Parse a ?: operation. Note that 'LHS' may be null