diff options
author | Mike Stump <mrs@apple.com> | 2010-01-21 23:15:53 +0000 |
---|---|---|
committer | Mike Stump <mrs@apple.com> | 2010-01-21 23:15:53 +0000 |
commit | b5c775575b496c03d862ea03587a9f1d74193c9f (patch) | |
tree | 8f1d3b75cf8511a05e258cecc9a4eeaafd27f294 /lib/Sema/SemaChecking.cpp | |
parent | 0380043d402fa87e00dc6166f9167ad4e73b34f4 (diff) |
Improve unreachable code warnings with respect to dead member and
dead array references.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94115 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaChecking.cpp')
-rw-r--r-- | lib/Sema/SemaChecking.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp index b792ea8071..608f4345b1 100644 --- a/lib/Sema/SemaChecking.cpp +++ b/lib/Sema/SemaChecking.cpp @@ -2116,6 +2116,17 @@ static SourceLocation GetUnreachableLoc(CFGBlock &b, SourceRange &R1, const ConditionalOperator *CO = cast<ConditionalOperator>(S); return CO->getQuestionLoc(); } + case Expr::MemberExprClass: { + const MemberExpr *ME = cast<MemberExpr>(S); + R1 = ME->getSourceRange(); + return ME->getMemberLoc(); + } + case Expr::ArraySubscriptExprClass: { + const ArraySubscriptExpr *ASE = cast<ArraySubscriptExpr>(S); + R1 = ASE->getLHS()->getSourceRange(); + R2 = ASE->getRHS()->getSourceRange(); + return ASE->getRBracketLoc(); + } case Expr::CStyleCastExprClass: { const CStyleCastExpr *CSC = cast<CStyleCastExpr>(S); R1 = CSC->getSubExpr()->getSourceRange(); @@ -2134,6 +2145,7 @@ static SourceLocation GetUnreachableLoc(CFGBlock &b, SourceRange &R1, } default: ; } + R1 = S->getSourceRange(); return S->getLocStart(); } |