diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2011-04-18 15:49:25 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2011-04-18 15:49:25 +0000 |
commit | b403d6d746239095a2c7bac958c924d92434e2b4 (patch) | |
tree | f18cc7c2e026f9d9e7c3cbd330b9ddb892fd6363 /lib/Sema/SemaStmt.cpp | |
parent | e84260513dc9fc17904c30c9400c5862a2d7fcb8 (diff) |
Fix PR9741. The implicit declarations created for range-based for loops weren't being added to the DeclContext (nor were they being marked as implicit). Also, the declarations were being emitted in the wrong order when building the CFG.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129700 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaStmt.cpp')
-rw-r--r-- | lib/Sema/SemaStmt.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/Sema/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp index 407618219f..e6609c08e2 100644 --- a/lib/Sema/SemaStmt.cpp +++ b/lib/Sema/SemaStmt.cpp @@ -1029,6 +1029,7 @@ static VarDecl *BuildForRangeVarDecl(Sema &SemaRef, SourceLocation Loc, TypeSourceInfo *TInfo = SemaRef.Context.getTrivialTypeSourceInfo(Type, Loc); VarDecl *Decl = VarDecl::Create(SemaRef.Context, DC, Loc, Loc, II, Type, TInfo, SC_Auto, SC_None); + Decl->setImplicit(); return Decl; } @@ -1052,6 +1053,7 @@ static bool FinishForRangeVarDecl(Sema &SemaRef, VarDecl *Decl, Expr *Init, SemaRef.AddInitializerToDecl(Decl, Init, /*DirectInit=*/false, /*TypeMayContainAuto=*/false); SemaRef.FinalizeDeclaration(Decl); + SemaRef.CurContext->addHiddenDecl(Decl); return false; } |