diff options
author | Ted Kremenek <kremenek@apple.com> | 2011-03-01 18:41:00 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2011-03-01 18:41:00 +0000 |
commit | 3aea4dac830cb03d883a13ab30c28a3a53beca58 (patch) | |
tree | 9bf4f73c8a61de06421787a085df0243de518685 /lib/Sema/SemaExpr.cpp | |
parent | 9e876876afc13aa671cc11a17c19907c599b9ab9 (diff) |
For C++, enhance -Warray-bounds to recursively analyze array subscript accesses in ?: expressions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126766 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaExpr.cpp')
-rw-r--r-- | lib/Sema/SemaExpr.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index bc2251a4e0..82ec6ee6e1 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -301,8 +301,7 @@ void Sema::DefaultLvalueConversion(Expr *&E) { if (T.hasQualifiers()) T = T.getUnqualifiedType(); - if (const ArraySubscriptExpr *ae = dyn_cast<ArraySubscriptExpr>(E)) - CheckArrayAccess(ae); + CheckArrayAccess(E); E = ImplicitCastExpr::Create(Context, T, CK_LValueToRValue, E, 0, VK_RValue); @@ -7432,9 +7431,7 @@ QualType Sema::CheckAssignmentOperands(Expr *LHS, Expr *&RHS, } // Check for trivial buffer overflows. - if (const ArraySubscriptExpr *ae - = dyn_cast<ArraySubscriptExpr>(LHS->IgnoreParenCasts())) - CheckArrayAccess(ae); + CheckArrayAccess(LHS->IgnoreParenCasts()); // C99 6.5.16p3: The type of an assignment expression is the type of the // left operand unless the left operand has qualified type, in which case |