aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaStmt.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2010-11-20 02:04:01 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2010-11-20 02:04:01 +0000
commit44aa1f397855f130e88e62ffc1029f7f83bb5d2e (patch)
treec6d1de9b78b047e771056e04fb99c703752f3e6c /lib/Sema/SemaStmt.cpp
parent7663f396651716c82280f8fdcf97ad8e27c1ce5a (diff)
Revert r119838 "Don't warn for empty 'if' body if there is a macro that expands to nothing"
and use a better and more general approach, where NullStmt has a flag to indicate whether it was preceded by an empty macro. Thanks to Abramo Bagnara for the hint! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119887 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaStmt.cpp')
-rw-r--r--lib/Sema/SemaStmt.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/Sema/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp
index c6194edac3..68b7a8c163 100644
--- a/lib/Sema/SemaStmt.cpp
+++ b/lib/Sema/SemaStmt.cpp
@@ -42,8 +42,8 @@ StmtResult Sema::ActOnExprStmt(FullExprArg expr) {
}
-StmtResult Sema::ActOnNullStmt(SourceLocation SemiLoc) {
- return Owned(new (Context) NullStmt(SemiLoc));
+StmtResult Sema::ActOnNullStmt(SourceLocation SemiLoc, bool LeadingEmptyMacro) {
+ return Owned(new (Context) NullStmt(SemiLoc, LeadingEmptyMacro));
}
StmtResult Sema::ActOnDeclStmt(DeclGroupPtrTy dg,
@@ -282,8 +282,8 @@ Sema::ActOnLabelStmt(SourceLocation IdentLoc, IdentifierInfo *II,
StmtResult
Sema::ActOnIfStmt(SourceLocation IfLoc, FullExprArg CondVal, Decl *CondVar,
- Stmt *thenStmt, bool MacroExpandedInThenStmt,
- SourceLocation ElseLoc, Stmt *elseStmt) {
+ Stmt *thenStmt, SourceLocation ElseLoc,
+ Stmt *elseStmt) {
ExprResult CondResult(CondVal.release());
VarDecl *ConditionVar = 0;
@@ -312,15 +312,14 @@ Sema::ActOnIfStmt(SourceLocation IfLoc, FullExprArg CondVal, Decl *CondVar,
// if (condition)
// CALL(0);
//
- if (!MacroExpandedInThenStmt)
+ if (!stmt->hasLeadingEmptyMacro())
Diag(stmt->getSemiLoc(), diag::warn_empty_if_body);
}
DiagnoseUnusedExprResult(elseStmt);
return Owned(new (Context) IfStmt(Context, IfLoc, ConditionVar, ConditionExpr,
- thenStmt, ElseLoc, elseStmt,
- MacroExpandedInThenStmt));
+ thenStmt, ElseLoc, elseStmt));
}
/// ConvertIntegerToTypeWarnOnOverflow - Convert the specified APInt to have