r224843 - WIP
David Majnemer
david.majnemer at gmail.com
Thu Dec 25 22:11:34 PST 2014
Sorry, this commit was supposed to have a more descriptive commit message.
This was a readability enhancement, Diag(Loc, Diag) is confusing and
unidiomatic.
On Fri, Dec 26, 2014 at 1:06 AM, David Majnemer <david.majnemer at gmail.com>
wrote:
> Author: majnemer
> Date: Fri Dec 26 00:06:53 2014
> New Revision: 224843
>
> URL: http://llvm.org/viewvc/llvm-project?rev=224843&view=rev
> Log:
> WIP
>
> 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=224843&r1=224842&r2=224843&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaExpr.cpp Fri Dec 26 00:06:53 2014
> @@ -8630,19 +8630,19 @@ static bool CheckForModifiableLvalue(Exp
> if (IsLV == Expr::MLV_Valid)
> return false;
>
> - unsigned Diag = 0;
> + unsigned DiagID = 0;
> bool NeedType = false;
> switch (IsLV) { // C99 6.5.16p2
> case Expr::MLV_ConstQualified:
> - Diag = diag::err_typecheck_assign_const;
> + DiagID = diag::err_typecheck_assign_const;
>
> // Use a specialized diagnostic when we're assigning to an object
> // from an enclosing function or block.
> if (NonConstCaptureKind NCCK = isReferenceToNonConstCapture(S, E)) {
> if (NCCK == NCCK_Block)
> - Diag = diag::err_block_decl_ref_not_modifiable_lvalue;
> + DiagID = diag::err_block_decl_ref_not_modifiable_lvalue;
> else
> - Diag = diag::err_lambda_decl_ref_not_modifiable_lvalue;
> + DiagID = diag::err_lambda_decl_ref_not_modifiable_lvalue;
> break;
> }
>
> @@ -8662,18 +8662,18 @@ static bool CheckForModifiableLvalue(Exp
> // - self
> ObjCMethodDecl *method = S.getCurMethodDecl();
> if (method && var == method->getSelfDecl())
> - Diag = method->isClassMethod()
> + DiagID = method->isClassMethod()
> ? diag::err_typecheck_arc_assign_self_class_method
> : diag::err_typecheck_arc_assign_self;
>
> // - fast enumeration variables
> else
> - Diag = diag::err_typecheck_arr_assign_enumeration;
> + DiagID = diag::err_typecheck_arr_assign_enumeration;
>
> SourceRange Assign;
> if (Loc != OrigLoc)
> Assign = SourceRange(OrigLoc, OrigLoc);
> - S.Diag(Loc, Diag) << E->getSourceRange() << Assign;
> + S.Diag(Loc, DiagID) << E->getSourceRange() << Assign;
> // We need to preserve the AST regardless, so migration tool
> // can do its job.
> return false;
> @@ -8684,37 +8684,37 @@ static bool CheckForModifiableLvalue(Exp
> break;
> case Expr::MLV_ArrayType:
> case Expr::MLV_ArrayTemporary:
> - Diag = diag::err_typecheck_array_not_modifiable_lvalue;
> + DiagID = diag::err_typecheck_array_not_modifiable_lvalue;
> NeedType = true;
> break;
> case Expr::MLV_NotObjectType:
> - Diag = diag::err_typecheck_non_object_not_modifiable_lvalue;
> + DiagID = diag::err_typecheck_non_object_not_modifiable_lvalue;
> NeedType = true;
> break;
> case Expr::MLV_LValueCast:
> - Diag = diag::err_typecheck_lvalue_casts_not_supported;
> + DiagID = diag::err_typecheck_lvalue_casts_not_supported;
> break;
> case Expr::MLV_Valid:
> llvm_unreachable("did not take early return for MLV_Valid");
> case Expr::MLV_InvalidExpression:
> case Expr::MLV_MemberFunction:
> case Expr::MLV_ClassTemporary:
> - Diag = diag::err_typecheck_expression_not_modifiable_lvalue;
> + DiagID = diag::err_typecheck_expression_not_modifiable_lvalue;
> break;
> case Expr::MLV_IncompleteType:
> case Expr::MLV_IncompleteVoidType:
> return S.RequireCompleteType(Loc, E->getType(),
> diag::err_typecheck_incomplete_type_not_modifiable_lvalue,
> E);
> case Expr::MLV_DuplicateVectorComponents:
> - Diag = diag::err_typecheck_duplicate_vector_components_not_mlvalue;
> + DiagID = diag::err_typecheck_duplicate_vector_components_not_mlvalue;
> break;
> case Expr::MLV_NoSetterProperty:
> llvm_unreachable("readonly properties should be processed
> differently");
> case Expr::MLV_InvalidMessageExpression:
> - Diag = diag::error_readonly_message_assignment;
> + DiagID = diag::error_readonly_message_assignment;
> break;
> case Expr::MLV_SubObjCPropertySetting:
> - Diag = diag::error_no_subobject_property_setting;
> + DiagID = diag::error_no_subobject_property_setting;
> break;
> }
>
> @@ -8722,9 +8722,9 @@ static bool CheckForModifiableLvalue(Exp
> if (Loc != OrigLoc)
> Assign = SourceRange(OrigLoc, OrigLoc);
> if (NeedType)
> - S.Diag(Loc, Diag) << E->getType() << E->getSourceRange() << Assign;
> + S.Diag(Loc, DiagID) << E->getType() << E->getSourceRange() << Assign;
> else
> - S.Diag(Loc, Diag) << E->getSourceRange() << Assign;
> + S.Diag(Loc, DiagID) << E->getSourceRange() << Assign;
> return true;
> }
>
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20141226/8d2e349e/attachment.html>
More information about the cfe-commits
mailing list