[Lldb-commits] [lldb] r154972 - in /lldb/trunk: include/lldb/Symbol/ClangASTContext.h source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp source/Symbol/ClangASTContext.cpp

Sean Callanan scallanan at apple.com
Tue Apr 17 18:06:17 PDT 2012


Author: spyffe
Date: Tue Apr 17 20:06:17 2012
New Revision: 154972

URL: http://llvm.org/viewvc/llvm-project?rev=154972&view=rev
Log:
We now record metadata for Objective-C interfaces,
Objective-C methods, and Objective-C properties.

Modified:
    lldb/trunk/include/lldb/Symbol/ClangASTContext.h
    lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
    lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
    lldb/trunk/source/Symbol/ClangASTContext.cpp

Modified: lldb/trunk/include/lldb/Symbol/ClangASTContext.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTContext.h?rev=154972&r1=154971&r2=154972&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/ClangASTContext.h (original)
+++ lldb/trunk/include/lldb/Symbol/ClangASTContext.h Tue Apr 17 20:06:17 2012
@@ -291,7 +291,7 @@
                       const char *name,
                       int kind,
                       lldb::LanguageType language,
-                      clang::CXXRecordDecl **decl = NULL);
+                      uint64_t metadata = 0);
 
     static clang::FieldDecl *
     AddFieldToRecordType (clang::ASTContext *ast,
@@ -449,7 +449,8 @@
     CreateObjCClass (const char *name, 
                      clang::DeclContext *decl_ctx, 
                      bool isForwardDecl, 
-                     bool isInternal);
+                     bool isInternal,
+                     uint64_t metadata = 0);
     
     static clang::FieldDecl *
     AddObjCClassIVar (clang::ASTContext *ast,
@@ -487,7 +488,8 @@
         clang::ObjCIvarDecl *ivar_decl,   
         const char *property_setter_name,
         const char *property_getter_name,
-        uint32_t property_attributes
+        uint32_t property_attributes,
+        uint64_t metadata = 0
     );
 
     bool
@@ -499,7 +501,8 @@
         clang::ObjCIvarDecl *ivar_decl,   
         const char *property_setter_name,
         const char *property_getter_name,
-        uint32_t property_attributes
+        uint32_t property_attributes,
+        uint64_t metadata = 0
     )
     {
         return ClangASTContext::AddObjCClassProperty (getASTContext(),
@@ -509,7 +512,8 @@
                                                       ivar_decl,
                                                       property_setter_name,
                                                       property_getter_name,
-                                                      property_attributes);
+                                                      property_attributes,
+                                                      metadata);
     }
     
     bool

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=154972&r1=154971&r2=154972&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Tue Apr 17 20:06:17 2012
@@ -1737,9 +1737,11 @@
                                                                        ivar_decl,
                                                                        prop_setter_name,
                                                                        prop_getter_name,
-                                                                       prop_attributes);
+                                                                       prop_attributes,
+                                                                       MakeUserID(die->GetOffset()));
                             
-                            GetClangASTContext().SetMetadata((uintptr_t)ivar_decl, MakeUserID(die->GetOffset()));
+                            if (ivar_decl)
+                                GetClangASTContext().SetMetadata((uintptr_t)ivar_decl, MakeUserID(die->GetOffset()));
                         }
                     }
                 }
@@ -5176,14 +5178,12 @@
                         if (!clang_type_was_created)
                         {
                             clang_type_was_created = true;
-                            clang::CXXRecordDecl *record_decl;
                             clang_type = ast.CreateRecordType (decl_ctx, 
                                                                accessibility, 
                                                                type_name_cstr, 
                                                                tag_decl_kind, 
                                                                class_language,
-                                                               &record_decl);
-                            GetClangASTContext().SetMetadata((uintptr_t)record_decl, MakeUserID(die->GetOffset()));
+                                                               MakeUserID(die->GetOffset()));
                         }
                     }
 

Modified: lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp?rev=154972&r1=154971&r2=154972&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp Tue Apr 17 20:06:17 2012
@@ -407,7 +407,8 @@
         lldb::clang_type_t objc_object_type = ast.CreateObjCClass (name.AsCString(), 
                                                                    ast.GetTranslationUnitDecl(), 
                                                                    isForwardDecl, 
-                                                                   isInternal);
+                                                                   isInternal,
+                                                                   0xffaaffaaffaaffaall);
         
         Declaration decl;
         

Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=154972&r1=154971&r2=154972&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Tue Apr 17 20:06:17 2012
@@ -1125,14 +1125,11 @@
 #pragma mark Structure, Unions, Classes
 
 clang_type_t
-ClangASTContext::CreateRecordType (DeclContext *decl_ctx, AccessType access_type, const char *name, int kind, LanguageType language, CXXRecordDecl **out_decl)
+ClangASTContext::CreateRecordType (DeclContext *decl_ctx, AccessType access_type, const char *name, int kind, LanguageType language, uint64_t metadata)
 {
     ASTContext *ast = getASTContext();
     assert (ast != NULL);
- 
-    if (out_decl)
-        *out_decl = NULL;
-    
+     
     if (decl_ctx == NULL)
         decl_ctx = ast->getTranslationUnitDecl();
 
@@ -1141,7 +1138,7 @@
     {
         bool isForwardDecl = true;
         bool isInternal = false;
-        return CreateObjCClass (name, decl_ctx, isForwardDecl, isInternal);
+        return CreateObjCClass (name, decl_ctx, isForwardDecl, isInternal, metadata);
     }
 
     // NOTE: Eventually CXXRecordDecl will be merged back into RecordDecl and
@@ -1156,8 +1153,8 @@
                                                  SourceLocation(),
                                                  name && name[0] ? &ast->Idents.get(name) : NULL);
     
-    if (out_decl)
-        *out_decl = decl;
+    if (decl)
+        SetMetadata(ast, (uintptr_t)decl, metadata);
     
     if (!name)
         decl->setAnonymousStructOrUnion(true);
@@ -2251,12 +2248,13 @@
 #pragma mark Objective C Classes
 
 clang_type_t
-ClangASTContext::CreateObjCClass 
+ClangASTContext::CreateObjCClass
 (
     const char *name, 
     DeclContext *decl_ctx, 
     bool isForwardDecl, 
-    bool isInternal
+    bool isInternal,
+    uint64_t metadata
 )
 {
     ASTContext *ast = getASTContext();
@@ -2279,6 +2277,9 @@
                                                          /*isForwardDecl,*/
                                                          isInternal);
     
+    if (decl)
+        SetMetadata(ast, (uintptr_t)decl, metadata);
+    
     return ast->getObjCInterfaceType(decl).getAsOpaquePtr();
 }
 
@@ -2390,7 +2391,8 @@
     ObjCIvarDecl *ivar_decl,
     const char *property_setter_name,
     const char *property_getter_name,
-    uint32_t property_attributes
+    uint32_t property_attributes,
+    uint64_t metadata
 )
 {
     if (class_opaque_type == NULL || property_name == NULL || property_name[0] == '\0')
@@ -2434,8 +2436,11 @@
                                                                            SourceLocation(), //Source location for (
                                                                            prop_type_source
                                                                            );
+                
                 if (property_decl)
                 {
+                    SetMetadata(ast, (uintptr_t)property_decl, metadata);
+                    
                     class_interface_decl->addDecl (property_decl);
                     
                     Selector setter_sel, getter_sel;
@@ -2512,6 +2517,9 @@
                                                                         isDefined,
                                                                         impControl,
                                                                         HasRelatedResultType);
+                        
+                        if (getter)
+                            SetMetadata(ast, (uintptr_t)getter, metadata);
                                                 
                         getter->setMethodParams(*ast, ArrayRef<ParmVarDecl*>(), ArrayRef<SourceLocation>());
                         
@@ -2545,6 +2553,9 @@
                                                                         impControl,
                                                                         HasRelatedResultType);
                         
+                        if (setter)
+                            SetMetadata(ast, (uintptr_t)setter, metadata);
+                        
                         llvm::SmallVector<ParmVarDecl *, 1> params;
 
                         params.push_back (ParmVarDecl::Create (*ast,





More information about the lldb-commits mailing list