aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Sema/SemaChecking.cpp6
-rw-r--r--test/Sema/warn-unreachable.c5
2 files changed, 11 insertions, 0 deletions
diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp
index 60134e2aa5..8fdb5ec87e 100644
--- a/lib/Sema/SemaChecking.cpp
+++ b/lib/Sema/SemaChecking.cpp
@@ -2102,6 +2102,12 @@ static SourceLocation GetUnreachableLoc(CFGBlock &b, SourceRange &R1,
R1 = UO->getSubExpr()->getSourceRange();
return UO->getOperatorLoc();
}
+ case Expr::CompoundAssignOperatorClass: {
+ const CompoundAssignOperator *CAO = cast<CompoundAssignOperator>(S);
+ R1 = CAO->getLHS()->getSourceRange();
+ R2 = CAO->getRHS()->getSourceRange();
+ return CAO->getOperatorLoc();
+ }
case Stmt::CXXTryStmtClass: {
return cast<CXXTryStmt>(S)->getHandler(0)->getCatchLoc();
}
diff --git a/test/Sema/warn-unreachable.c b/test/Sema/warn-unreachable.c
index bbebebcc90..fc56a87286 100644
--- a/test/Sema/warn-unreachable.c
+++ b/test/Sema/warn-unreachable.c
@@ -24,6 +24,7 @@ void test1() {
}
void test2() {
+ int i;
switch (live()) {
case 1:
halt(),
@@ -78,5 +79,9 @@ void test2() {
dead();
- // expected-warning {{will never be executed}}
halt();
+ case 8:
+ i
+ += // expected-warning {{will never be executed}}
+ halt();
}
}