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 | 9e2e22f5c6571931290970e1042e7257a14027e7 (patch) | |
tree | 3a90166a0f3ee4facb1263e2aecc31a588f81b09 /clang/lib/CodeGen/CGDecl.cpp | |
parent | 666cf56668e5be83c4e8424c188f727a6b852312 (diff) | |
download | bcm5719-llvm-9e2e22f5c6571931290970e1042e7257a14027e7.tar.gz bcm5719-llvm-9e2e22f5c6571931290970e1042e7257a14027e7.zip |
Establish the iteration variable of an ObjC for-in loop before
emitting the collection expression. Fixes some really, really broken
code.
llvm-svn: 126193
Diffstat (limited to 'clang/lib/CodeGen/CGDecl.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGDecl.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp index 7c6b1905a7e..d44d2aabd25 100644 --- a/clang/lib/CodeGen/CGDecl.cpp +++ b/clang/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) { |