summaryrefslogtreecommitdiff
path: root/lib/Sema/SemaStmt.cpp
diff options
context:
space:
mode:
authorRoman Divacky <rdivacky@FreeBSD.org>2010-03-16 16:52:15 +0000
committerRoman Divacky <rdivacky@FreeBSD.org>2010-03-16 16:52:15 +0000
commit4a37f65f1c1373c9956d118a012943de2f61edb0 (patch)
tree52aebaff3a47b97dbac434530524c30967468412 /lib/Sema/SemaStmt.cpp
parenta16e9ac1f192503038f49e0c52edd7dcb2ce023a (diff)
Notes
Diffstat (limited to 'lib/Sema/SemaStmt.cpp')
-rw-r--r--lib/Sema/SemaStmt.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/Sema/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp
index 75d9f67ad9d2..fd65c32c203e 100644
--- a/lib/Sema/SemaStmt.cpp
+++ b/lib/Sema/SemaStmt.cpp
@@ -76,10 +76,6 @@ void Sema::DiagnoseUnusedExprResult(const Stmt *S) {
if (!E)
return;
- // Ignore expressions that have void type.
- if (E->getType()->isVoidType())
- return;
-
SourceLocation Loc;
SourceRange R1, R2;
if (!E->isUnusedResultAWarning(Loc, R1, R2, Context))
@@ -103,6 +99,9 @@ void Sema::DiagnoseUnusedExprResult(const Stmt *S) {
}
if (const CallExpr *CE = dyn_cast<CallExpr>(E)) {
+ if (E->getType()->isVoidType())
+ return;
+
// If the callee has attribute pure, const, or warn_unused_result, warn with
// a more specific message to make it clear what is happening.
if (const Decl *FD = CE->getCalleeDecl()) {