Fix <rdar://problem/6451399> problems with labels and blocks.

- Move the 'LabelMap' from Sema to Scope. To avoid layering problems, the second element is now a 'StmtTy *', which makes the LabelMap a bit more verbose to deal with.
- Add 'ActiveScope' to Sema. Managed by ActOnStartOfFunctionDef(), ObjCActOnStartOfMethodDef(), ActOnBlockStmtExpr().
- Changed ActOnLabelStmt(), ActOnGotoStmt(), ActOnAddrLabel(), and ActOnFinishFunctionBody() to use the new ActiveScope.
- Added FIXME to workaround in ActOnFinishFunctionBody() (for dealing with C++ nested functions).  


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65694 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/Sema.h b/lib/Sema/Sema.h
index fe8176f..1b6d6c1 100644
--- a/lib/Sema/Sema.h
+++ b/lib/Sema/Sema.h
@@ -102,15 +102,14 @@
   /// the active block object that represents it.
   BlockSemaInfo *CurBlock;
 
+  /// ActiveScope - If inside of a function, method, or block definition, 
+  /// this contains a pointer to the active scope that represents it.
+  Scope *ActiveScope;
+  
   /// PackContext - Manages the stack for #pragma pack. An alignment
   /// of 0 indicates default alignment.
   void *PackContext; // Really a "PragmaPackStack*"
 
-  /// LabelMap - This is a mapping from label identifiers to the LabelStmt for
-  /// it (which acts like the label decl in some ways).  Forward referenced
-  /// labels have a LabelStmt created for them with a null location & SubStmt.
-  llvm::DenseMap<IdentifierInfo*, LabelStmt*> LabelMap;
-  
   llvm::SmallVector<SwitchStmt*, 8> SwitchStack;
   
   /// ExtVectorDecls - This is a list all the extended vector types. This allows
@@ -2070,6 +2069,10 @@
   /// arguments etc.
   Scope *TheScope;
   
+  /// PrevFunctionScope - This is the scope for the enclosing function.
+  /// For global blocks, this will be null.
+  Scope *PrevFunctionScope;
+  
   /// ReturnType - This will get set to block result type, by looking at
   /// return types, if any, in the block body.
   Type *ReturnType;