[Lldb-commits] [lldb] r115268 - in /lldb/trunk: include/lldb/Symbol/ClangASTContext.h source/Expression/ClangExpressionDeclMap.cpp source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp source/Symbol/ClangASTContext.cpp

Greg Clayton gclayton at apple.com
Thu Sep 30 19:31:07 PDT 2010


Author: gclayton
Date: Thu Sep 30 21:31:07 2010
New Revision: 115268

URL: http://llvm.org/viewvc/llvm-project?rev=115268&view=rev
Log:
Make C++ constructors and destructors correctly within the clang types we
generate from DWARF.


Modified:
    lldb/trunk/include/lldb/Symbol/ClangASTContext.h
    lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.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=115268&r1=115267&r2=115268&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/ClangASTContext.h (original)
+++ lldb/trunk/include/lldb/Symbol/ClangASTContext.h Thu Sep 30 21:31:07 2010
@@ -190,7 +190,8 @@
                               lldb::AccessType access,
                               bool is_virtual,
                               bool is_static,
-                              bool is_inline);
+                              bool is_inline,
+                              bool is_explicit);
     
     clang::CXXMethodDecl *
     AddMethodToCXXRecordType (lldb::clang_type_t record_opaque_type,
@@ -199,7 +200,8 @@
                               lldb::AccessType access,
                               bool is_virtual,
                               bool is_static,
-                              bool is_inline)
+                              bool is_inline,
+                              bool is_explicit)
     
     {
         return ClangASTContext::AddMethodToCXXRecordType (getASTContext(),
@@ -209,7 +211,8 @@
                                                           access,
                                                           is_virtual,
                                                           is_static,
-                                                          is_inline);
+                                                          is_inline,
+                                                          is_explicit);
     }
     
     bool

Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp?rev=115268&r1=115267&r2=115268&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp (original)
+++ lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Thu Sep 30 21:31:07 2010
@@ -1119,11 +1119,12 @@
                                                                  1,
                                                                  false,
                                                                  ClangASTContext::GetTypeQualifiers(copied_type));
-        
+
         const bool is_virtual = false;
         const bool is_static = false;
         const bool is_inline = false;
-
+        const bool is_explicit = false;
+        
         ClangASTContext::AddMethodToCXXRecordType (parser_ast_context,
                                                    copied_type,
                                                    "___clang_expr",
@@ -1131,7 +1132,8 @@
                                                    lldb::eAccessPublic,
                                                    is_virtual,
                                                    is_static,
-                                                   is_inline);
+                                                   is_inline,
+                                                   is_explicit);
     }
     
     context.AddTypeDecl(copied_type);

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=115268&r1=115267&r2=115268&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Thu Sep 30 21:31:07 2010
@@ -2797,6 +2797,7 @@
                     bool is_inline = false;
                     bool is_static = false;
                     bool is_virtual = false;
+                    bool is_explicit = false;
 
                     unsigned type_quals = 0;
                     clang::StorageClass storage = clang::SC_None;//, Extern, Static, PrivateExtern
@@ -2828,6 +2829,8 @@
                                 case DW_AT_declaration:         is_forward_declaration = form_value.Unsigned() != 0; break;
                                 case DW_AT_inline:              is_inline = form_value.Unsigned() != 0; break;
                                 case DW_AT_virtuality:          is_virtual = form_value.Unsigned() != 0;  break;
+                                case DW_AT_explicit:            is_explicit = form_value.Unsigned() != 0;  break; 
+
                                 case DW_AT_external:
                                     if (form_value.Unsigned())
                                     {
@@ -2846,7 +2849,6 @@
                                 case DW_AT_data_location:
                                 case DW_AT_elemental:
                                 case DW_AT_entry_pc:
-                                case DW_AT_explicit:
                                 case DW_AT_frame_base:
                                 case DW_AT_high_pc:
                                 case DW_AT_low_pc:
@@ -2872,12 +2874,17 @@
                         }
 
                         clang_type_t return_clang_type = NULL;
-                        Type *func_type = ResolveTypeUID(type_die_offset);
+                        Type *func_type = NULL;
+                        
+                        if (type_die_offset != DW_INVALID_OFFSET)
+                            func_type = ResolveTypeUID(type_die_offset);
+
                         if (func_type)
                             return_clang_type = func_type->GetClangType(true);
                         else
                             return_clang_type = type_list->GetClangASTContext().GetBuiltInType_void();
 
+
                         std::vector<clang_type_t> function_param_types;
                         std::vector<clang::ParmVarDecl*> function_param_decls;
 
@@ -2887,6 +2894,7 @@
 
                         // clang_type will get the function prototype clang type after this call
                         clang_type = type_list->GetClangASTContext().CreateFunctionType (return_clang_type, &function_param_types[0], function_param_types.size(), is_variadic, type_quals);
+
                         if (type_name_cstr)
                         {
                             bool type_handled = false;
@@ -2960,7 +2968,8 @@
                                                                                                                         accessibility,
                                                                                                                         is_virtual,
                                                                                                                         is_static,
-                                                                                                                        is_inline);
+                                                                                                                        is_inline,
+                                                                                                                        is_explicit);
                                             type_handled = cxx_method_decl != NULL;
                                         }
                                     }

Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=115268&r1=115267&r2=115268&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Thu Sep 30 21:31:07 2010
@@ -813,7 +813,8 @@
     lldb::AccessType access,
     bool is_virtual,
     bool is_static,
-    bool is_inline
+    bool is_inline,
+    bool is_explicit
 )
 {
     if (!record_opaque_type || !method_opaque_type || !name)
@@ -849,15 +850,34 @@
     
     QualType method_qual_type (QualType::getFromOpaquePtr (method_opaque_type));
     
-    CXXMethodDecl *cxx_method_decl = CXXMethodDecl::Create (*ast_context,
-                                                            cxx_record_decl,
-                                                            DeclarationNameInfo (DeclarationName (&identifier_table->get(name)), SourceLocation()),
-                                                            method_qual_type,
-                                                            NULL, // TypeSourceInfo *
-                                                            is_static,
-                                                            SC_None,
-                                                            is_inline);
+    CXXMethodDecl *cxx_method_decl = NULL;
+    
+    DeclarationName decl_name (&identifier_table->get(name));
     
+    if (name[0] == '~' || decl_name == record_decl->getDeclName())
+    {
+        bool is_implicitly_declared = false;
+        cxx_method_decl = CXXConstructorDecl::Create (*ast_context,
+                                                      cxx_record_decl,
+                                                      DeclarationNameInfo (decl_name, SourceLocation()),
+                                                      method_qual_type,
+                                                      NULL, // TypeSourceInfo *
+                                                      is_explicit, 
+                                                      is_inline,
+                                                      is_implicitly_declared);
+    }
+    else
+    {    
+        cxx_method_decl = CXXMethodDecl::Create (*ast_context,
+                                                 cxx_record_decl,
+                                                 DeclarationNameInfo (decl_name, SourceLocation()),
+                                                 method_qual_type,
+                                                 NULL, // TypeSourceInfo *
+                                                 is_static,
+                                                 SC_None,
+                                                 is_inline);
+    }
+        
     
     AccessSpecifier access_specifier = ConvertAccessTypeToAccessSpecifier (access);
     





More information about the lldb-commits mailing list