Brought LLDB top-of-tree into sync with LLVM/Clang
top-of-tree.  Removed all local patches and llvm.zip.

The intent is that fron now on top-of-tree will
always build against LLVM/Clang top-of-tree, and
that problems building will be resolved as they
occur.  Stable release branches of LLDB can be
constructed as needed and linked to specific release
branches of LLVM/Clang.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@164563 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Expression/ASTStructExtractor.cpp b/source/Expression/ASTStructExtractor.cpp
index 7bc31a5..d1f2192 100644
--- a/source/Expression/ASTStructExtractor.cpp
+++ b/source/Expression/ASTStructExtractor.cpp
@@ -59,13 +59,42 @@
 void
 ASTStructExtractor::ExtractFromFunctionDecl(FunctionDecl *F)
 {
-    DeclarationName struct_name(&m_ast_context->Idents.get(m_struct_name.c_str()));
-    RecordDecl::lookup_result struct_lookup = F->lookup(struct_name);
-    
-    if (struct_lookup.first == struct_lookup.second)
+    if (!F->hasBody())
         return;
     
-    RecordDecl *struct_decl = dyn_cast<RecordDecl>(*(struct_lookup.first));
+    Stmt *body_stmt = F->getBody();
+    CompoundStmt *body_compound_stmt = dyn_cast<CompoundStmt>(body_stmt);
+    
+    if (!body_compound_stmt)
+        return; // do we have to handle this?
+    
+    RecordDecl *struct_decl = NULL;
+    
+    StringRef desired_name(m_struct_name.c_str());
+    
+    for (CompoundStmt::const_body_iterator bi = body_compound_stmt->body_begin(), be = body_compound_stmt->body_end();
+         bi != be;
+         ++bi)
+    {
+        Stmt *curr_stmt = *bi;
+        DeclStmt *curr_decl_stmt = dyn_cast<DeclStmt>(curr_stmt);
+        if (!curr_decl_stmt)
+            continue;
+        DeclGroupRef decl_group = curr_decl_stmt->getDeclGroup();
+        for (Decl *candidate_decl : decl_group)
+        {
+            RecordDecl *candidate_record_decl = dyn_cast<RecordDecl>(candidate_decl);
+            if (!candidate_record_decl)
+                continue;
+            if (candidate_record_decl->getName() == desired_name)
+            {
+                struct_decl = candidate_record_decl;
+                break;
+            }
+        }
+        if (struct_decl)
+            break;
+    }
     
     if (!struct_decl)
         return;