forked from OSchip/llvm-project
Don't issue spurious diagnostic with Obj-C fast enumeration.
(radar 7409165). llvm-svn: 89400
This commit is contained in:
parent
f94c02600f
commit
e774fa6412
|
@ -668,6 +668,9 @@ public:
|
|||
return StmtEmpty();
|
||||
}
|
||||
|
||||
virtual void ActOnForEachDeclStmt(DeclGroupPtrTy Decl) {
|
||||
}
|
||||
|
||||
virtual OwningStmtResult ActOnExprStmt(FullExprArg Expr) {
|
||||
return OwningStmtResult(*this, Expr->release());
|
||||
}
|
||||
|
|
|
@ -944,6 +944,7 @@ Parser::OwningStmtResult Parser::ParseForStatement() {
|
|||
if (Tok.is(tok::semi)) { // for (int x = 4;
|
||||
ConsumeToken();
|
||||
} else if ((ForEach = isTokIdentifier_in())) {
|
||||
Actions.ActOnForEachDeclStmt(DG);
|
||||
// ObjC: for (id x in expr)
|
||||
ConsumeToken(); // consume 'in'
|
||||
SecondPart = ParseExpression();
|
||||
|
|
|
@ -1260,6 +1260,7 @@ public:
|
|||
virtual OwningStmtResult ActOnDeclStmt(DeclGroupPtrTy Decl,
|
||||
SourceLocation StartLoc,
|
||||
SourceLocation EndLoc);
|
||||
virtual void ActOnForEachDeclStmt(DeclGroupPtrTy Decl);
|
||||
virtual OwningStmtResult ActOnCaseStmt(SourceLocation CaseLoc, ExprArg LHSVal,
|
||||
SourceLocation DotDotDotLoc, ExprArg RHSVal,
|
||||
SourceLocation ColonLoc);
|
||||
|
|
|
@ -59,6 +59,15 @@ Sema::OwningStmtResult Sema::ActOnDeclStmt(DeclGroupPtrTy dg,
|
|||
return Owned(new (Context) DeclStmt(DG, StartLoc, EndLoc));
|
||||
}
|
||||
|
||||
void Sema::ActOnForEachDeclStmt(DeclGroupPtrTy dg) {
|
||||
DeclGroupRef DG = dg.getAsVal<DeclGroupRef>();
|
||||
|
||||
// If we have an invalid decl, just return.
|
||||
if (DG.isNull() || !DG.isSingleDecl()) return;
|
||||
// suppress any potential 'unused variable' warning.
|
||||
DG.getSingleDecl()->setUsed();
|
||||
}
|
||||
|
||||
void Sema::DiagnoseUnusedExprResult(const Stmt *S) {
|
||||
const Expr *E = dyn_cast_or_null<Expr>(S);
|
||||
if (!E)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* RUN: clang-cc -fsyntax-only -verify -std=c89 -pedantic %s
|
||||
/* RUN: clang-cc -Wall -fsyntax-only -verify -std=c89 -pedantic %s
|
||||
*/
|
||||
|
||||
@class NSArray;
|
||||
|
|
Loading…
Reference in New Issue