diff options
author | John McCall <rjmccall@apple.com> | 2011-02-22 07:16:58 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2011-02-22 07:16:58 +0000 |
commit | 57b3b6a60856eaec30fd876a8a3face8f7e3ad7b (patch) | |
tree | 06247fed84349aebc8f4d39b8c2dc7c110f07324 /lib/CodeGen/CGDecl.cpp | |
parent | 34695856c0e67b3765b46304cc71b5d2cd5b71c7 (diff) |
Establish the iteration variable of an ObjC for-in loop before
emitting the collection expression. Fixes some really, really broken
code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126193 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGDecl.cpp')
-rw-r--r-- | lib/CodeGen/CGDecl.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/CodeGen/CGDecl.cpp b/lib/CodeGen/CGDecl.cpp index 7c6b1905a7..d44d2aabd2 100644 --- a/lib/CodeGen/CGDecl.cpp +++ b/lib/CodeGen/CGDecl.cpp @@ -782,10 +782,12 @@ static bool isCapturedBy(const VarDecl &var, const Expr *e) { } void CodeGenFunction::EmitAutoVarInit(const AutoVarEmission &emission) { + assert(emission.Variable && "emission was not valid!"); + // If this was emitted as a global constant, we're done. if (emission.wasEmittedAsGlobal()) return; - const VarDecl &D = emission.Variable; + const VarDecl &D = *emission.Variable; QualType type = D.getType(); // If this local has an initializer, emit it now. @@ -940,10 +942,12 @@ void CodeGenFunction::EmitAutoVarInit(const AutoVarEmission &emission) { } void CodeGenFunction::EmitAutoVarCleanups(const AutoVarEmission &emission) { + assert(emission.Variable && "emission was not valid!"); + // If this was emitted as a global constant, we're done. if (emission.wasEmittedAsGlobal()) return; - const VarDecl &D = emission.Variable; + const VarDecl &D = *emission.Variable; // Handle C++ destruction of variables. if (getLangOptions().CPlusPlus) { |