summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaStmt.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2010-09-19 21:21:10 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2010-09-19 21:21:10 +0000
commit90963413104034cd883c93e08f7b30949429b169 (patch)
tree044e423c1ecd45cc94b91f1b887c344fdc715e89 /clang/lib/Sema/SemaStmt.cpp
parent7b8d2ae9129a68dfb058f209f2fec4db032639cf (diff)
downloadbcm5719-llvm-90963413104034cd883c93e08f7b30949429b169.tar.gz
bcm5719-llvm-90963413104034cd883c93e08f7b30949429b169.zip
Warn when an expression result in a LabelStmt is unused.
llvm-svn: 114314
Diffstat (limited to 'clang/lib/Sema/SemaStmt.cpp')
-rw-r--r--clang/lib/Sema/SemaStmt.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp
index 8ec12a460db..47ea4f2c253 100644
--- a/clang/lib/Sema/SemaStmt.cpp
+++ b/clang/lib/Sema/SemaStmt.cpp
@@ -67,6 +67,9 @@ void Sema::ActOnForEachDeclStmt(DeclGroupPtrTy dg) {
}
void Sema::DiagnoseUnusedExprResult(const Stmt *S) {
+ if (const LabelStmt *Label = dyn_cast_or_null<LabelStmt>(S))
+ return DiagnoseUnusedExprResult(Label->getSubStmt());
+
const Expr *E = dyn_cast_or_null<Expr>(S);
if (!E)
return;
OpenPOWER on IntegriCloud