]> granicus.if.org Git - clang/commitdiff
Remove unused slot/reference and update Sema::ActOnIdentifierExpr().
authorSteve Naroff <snaroff@apple.com>
Mon, 22 Sep 2008 15:31:56 +0000 (15:31 +0000)
committerSteve Naroff <snaroff@apple.com>
Mon, 22 Sep 2008 15:31:56 +0000 (15:31 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56438 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/Sema.h
lib/Sema/SemaExpr.cpp

index 99ce5a742931d4e091eff605bc05a6a6a1f8238f..4fbd7351136930cc6d53d97268e7849475902383 100644 (file)
@@ -1038,7 +1038,6 @@ public:
 /// about the block.  It is pointed to from Sema::CurBlock.
 struct BlockSemaInfo {
   llvm::SmallVector<ParmVarDecl*, 8> Params;
-  llvm::SmallPtrSet<Decl*, 4> ByRefVars;
   bool hasPrototype;
   bool isVariadic;
   
index b7d5c8e12c0e5a10d8c81c55de2bd91eef610915..e374a035cb7aa832e131b115ef16520954e255dd 100644 (file)
@@ -436,11 +436,12 @@ Sema::ExprResult Sema::ActOnIdentifierExpr(Scope *S, SourceLocation Loc,
   // If we are in a block and the variable is outside the current block,
   // bind the variable reference with a BlockDeclRefExpr.
   
-  // If the variable is in the byref set, bind it directly, otherwise it will be
-  // bound by-copy, thus we make it const within the closure.
-  if (!CurBlock->ByRefVars.count(VD))
-    VD->getType().addConst();
+  // The BlocksAttr indicates the variable is bound by-reference.
+  if (VD->getAttr<BlocksAttr>())
+    return new BlockDeclRefExpr(VD, VD->getType(), Loc, true);
     
+  // Variable will be bound by-copy, make it const within the closure.
+  VD->getType().addConst();
   return new BlockDeclRefExpr(VD, VD->getType(), Loc, false);
 }