[Lldb-commits] [lldb] r166256 - /lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp

Sean Callanan scallanan at apple.com
Thu Oct 18 18:37:25 PDT 2012


Author: spyffe
Date: Thu Oct 18 20:37:25 2012
New Revision: 166256

URL: http://llvm.org/viewvc/llvm-project?rev=166256&view=rev
Log:
Fixed a bug where empty C structs were given size
1 by the expression parser.  We now correctly
report that they are of size 0.  (C++ structs
are mandated to have nonzero size, and Clang marks
them as being 1 byte in size.)

<rdar://problem/12380800>

Modified:
    lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp

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=166256&r1=166255&r2=166256&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Thu Oct 18 20:37:25 2012
@@ -5611,6 +5611,27 @@
                             // No children for this struct/union/class, lets finish it
                             ast.StartTagDeclarationDefinition (clang_type);
                             ast.CompleteTagDeclarationDefinition (clang_type);
+                            
+                            if (tag == DW_TAG_structure_type) // this only applies in C
+                            {
+                                clang::QualType qual_type = clang::QualType::getFromOpaquePtr (clang_type);
+                                const clang::RecordType *record_type = qual_type->getAs<clang::RecordType> ();
+                                
+                                if (record_type)
+                                {
+                                    clang::RecordDecl *record_decl = record_type->getDecl();
+                                    
+                                    if (record_decl)
+                                    {
+                                        LayoutInfo layout_info;
+                                        
+                                        layout_info.alignment = 0;
+                                        layout_info.bit_size = 0;
+                                        
+                                        m_record_decl_to_layout_map.insert(std::make_pair(record_decl, layout_info));
+                                    }
+                                }
+                            }
                         }
                         else if (clang_type_was_created)
                         {





More information about the lldb-commits mailing list