[cfe-commits] r139167 - /cfe/trunk/lib/Sema/SemaExpr.cpp
Richard Trieu
rtrieu at google.com
Tue Sep 6 13:06:39 PDT 2011
Author: rtrieu
Date: Tue Sep 6 15:06:39 2011
New Revision: 139167
URL: http://llvm.org/viewvc/llvm-project?rev=139167&view=rev
Log:
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()
Modified:
cfe/trunk/lib/Sema/SemaExpr.cpp
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=139167&r1=139166&r2=139167&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Tue Sep 6 15:06:39 2011
@@ -4371,17 +4371,17 @@
/// \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
/// emitted.
-bool Sema::DiagnoseConditionalForNull(Expr *LHS, Expr *RHS,
+bool Sema::DiagnoseConditionalForNull(Expr *LHSExpr, Expr *RHSExpr,
SourceLocation QuestionLoc) {
- Expr *NullExpr = LHS;
- Expr *NonPointerExpr = RHS;
+ Expr *NullExpr = LHSExpr;
+ Expr *NonPointerExpr = RHSExpr;
Expr::NullPointerConstantKind NullKind =
NullExpr->isNullPointerConstant(Context,
Expr::NPC_ValueDependentIsNotNull);
if (NullKind == Expr::NPCK_NotNull) {
- NullExpr = RHS;
- NonPointerExpr = LHS;
+ NullExpr = RHSExpr;
+ NonPointerExpr = LHSExpr;
NullKind =
NullExpr->isNullPointerConstant(Context,
Expr::NPC_ValueDependentIsNotNull);
@@ -4613,21 +4613,21 @@
return true;
}
-/// Note that lhs is not null here, even if this is the gnu "x ?: y" extension.
-/// In that case, lhs = cond.
+/// Note that LHS is not null here, even if this is the gnu "x ?: y" extension.
+/// In that case, LHS = cond.
/// C99 6.5.15
QualType Sema::CheckConditionalOperands(ExprResult &Cond, ExprResult &LHS,
ExprResult &RHS, ExprValueKind &VK,
ExprObjectKind &OK,
SourceLocation QuestionLoc) {
- ExprResult lhsResult = CheckPlaceholderExpr(LHS.get());
- if (!lhsResult.isUsable()) return QualType();
- LHS = move(lhsResult);
-
- ExprResult rhsResult = CheckPlaceholderExpr(RHS.get());
- if (!rhsResult.isUsable()) return QualType();
- RHS = move(rhsResult);
+ ExprResult LHSResult = CheckPlaceholderExpr(LHS.get());
+ if (!LHSResult.isUsable()) return QualType();
+ LHS = move(LHSResult);
+
+ ExprResult RHSResult = CheckPlaceholderExpr(RHS.get());
+ if (!RHSResult.isUsable()) return QualType();
+ RHS = move(RHSResult);
// C++ is sufficiently different to merit its own checker.
if (getLangOptions().CPlusPlus)
@@ -4885,9 +4885,10 @@
/// IsArithmeticBinaryExpr - Returns true if E is an arithmetic binary
/// 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,
- Expr **RHS) {
+ Expr **RHSExprs) {
E = E->IgnoreParenImpCasts();
E = E->IgnoreConversionOperator();
E = E->IgnoreParenImpCasts();
@@ -4896,7 +4897,7 @@
if (BinaryOperator *OP = dyn_cast<BinaryOperator>(E)) {
if (IsArithmeticOp(OP->getOpcode())) {
*Opcode = OP->getOpcode();
- *RHS = OP->getRHS();
+ *RHSExprs = OP->getRHS();
return true;
}
}
@@ -4915,7 +4916,7 @@
BinaryOperatorKind OpKind = BinaryOperator::getOverloadedOpcode(OO);
if (IsArithmeticOp(OpKind)) {
*Opcode = OpKind;
- *RHS = Call->getArg(1);
+ *RHSExprs = Call->getArg(1);
return true;
}
}
@@ -4950,8 +4951,8 @@
static void DiagnoseConditionalPrecedence(Sema &Self,
SourceLocation OpLoc,
Expr *Condition,
- Expr *LHS,
- Expr *RHS) {
+ Expr *LHSExpr,
+ Expr *RHSExpr) {
BinaryOperatorKind CondOpcode;
Expr *CondRHS;
@@ -4974,7 +4975,7 @@
SuggestParentheses(Self, OpLoc,
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
More information about the cfe-commits
mailing list