Skip to content

Commit f3f1d9b

Browse files
committed
Remove bad merge
1 parent 12a6de9 commit f3f1d9b

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

clang/lib/Sema/SemaStmt.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2269,10 +2269,11 @@ StmtResult Sema::ActOnForStmt(SourceLocation ForLoc, SourceLocation LParenLoc,
22692269
for (auto *DI : DS->decls()) {
22702270
if (VarDecl *VD = dyn_cast<VarDecl>(DI)) {
22712271
VarDeclSeen = true;
2272-
if (VD->isLocalVarDecl() && !VD->hasLocalStorage()) {
2273-
Diag(DI->getLocation(), diag::err_non_local_variable_decl_in_for);
2274-
DI->setInvalidDecl();
2275-
}
2272+
if (VD->isLocalVarDecl() && !VD->hasLocalStorage())
2273+
Diag(DI->getLocation(),
2274+
getLangOpts().C23
2275+
? diag::warn_c17_non_local_variable_decl_in_for
2276+
: diag::ext_c23_non_local_variable_decl_in_for);
22762277
} else if (!NonVarSeen) {
22772278
// Keep track of the first non-variable declaration we saw so that
22782279
// we can diagnose if we don't see any variable declarations. This
@@ -2284,7 +2285,9 @@ StmtResult Sema::ActOnForStmt(SourceLocation ForLoc, SourceLocation LParenLoc,
22842285
// Diagnose if we saw a non-variable declaration but no variable
22852286
// declarations.
22862287
if (NonVarSeen && !VarDeclSeen)
2287-
Diag(NonVarSeen->getLocation(), diag::err_non_variable_decl_in_for);
2288+
Diag(NonVarSeen->getLocation(),
2289+
getLangOpts().C23 ? diag::warn_c17_non_variable_decl_in_for
2290+
: diag::ext_c23_non_variable_decl_in_for);
22882291
}
22892292
}
22902293

0 commit comments

Comments
 (0)