[Lldb-commits] [lldb] r115023 - in /lldb/trunk: llvm.zip scripts/build-llvm.pl source/Symbol/ClangASTContext.cpp

Greg Clayton gclayton at apple.com
Tue Sep 28 20:44:17 PDT 2010


Author: gclayton
Date: Tue Sep 28 22:44:17 2010
New Revision: 115023

URL: http://llvm.org/viewvc/llvm-project?rev=115023&view=rev
Log:
Updated LLVM to: --revision '{2010-09-28T19:30}'

This gets us the new clang::CXXRecordDecl improvments in clang so that when we
add fields, methods and other things to the clang::CXXRecordDecl, the correct
bits are automatically set by clang::CXXRecordDecl itself instead of having 
SEMA and our lldb_private::ClangASTContext functions that create types for
DWARF do it all manually. This allows the clang::ASTContext deep copying of
types to work correctly and it means that the expression parser can now 
evaluate expressions in the context of a class method correctly. Previously
when a class was copied from the DWARF generated ASTContext over into the
expression ASTContext, we were losing CXXRecordDecl bits in the conversion
which caused all classes to think they were at offset zero because the the 
bools for empty, POD, and others would end up being incorrect.


Modified:
    lldb/trunk/llvm.zip
    lldb/trunk/scripts/build-llvm.pl
    lldb/trunk/source/Symbol/ClangASTContext.cpp

Modified: lldb/trunk/llvm.zip
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/llvm.zip?rev=115023&r1=115022&r2=115023&view=diff
==============================================================================
Binary files - no diff available.

Modified: lldb/trunk/scripts/build-llvm.pl
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/build-llvm.pl?rev=115023&r1=115022&r2=115023&view=diff
==============================================================================
--- lldb/trunk/scripts/build-llvm.pl (original)
+++ lldb/trunk/scripts/build-llvm.pl Tue Sep 28 22:44:17 2010
@@ -25,7 +25,7 @@
 
 our $llvm_configuration = $ENV{LLVM_CONFIGURATION};
 
-our $llvm_revision = "'{2010-09-22T21:20}'";
+our $llvm_revision = "'{2010-09-28T19:30}'";
 our $llvm_source_dir = "$ENV{SRCROOT}";
 our $cc = "$ENV{DEVELOPER_BIN_DIR}/gcc-4.2";
 our $cxx = "$ENV{DEVELOPER_BIN_DIR}/g++-4.2";

Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=115023&r1=115022&r2=115023&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Tue Sep 28 22:44:17 2010
@@ -931,25 +931,6 @@
         {
             RecordDecl *record_decl = record_type->getDecl();
 
-            CXXRecordDecl *cxx_record_decl = dyn_cast<CXXRecordDecl>(record_decl);
-            if (cxx_record_decl)
-            {
-                // NOTE: we currently have some fixes that should be placed
-                // into clang that will automatically set if a record is empty
-                // when each field is added (during the addDecl() method call 
-                // below) so this code should be able to come out when those 
-                // changes make it into llvm/clang, then we can remove this 
-                // code...
-                // Currently SEMA is using the accessors manually to set 
-                // whether a class is empty, is POD, is aggregate, and more.
-                // This code will be moved into CXXRecordDecl so everyone
-                // can benefit.
-                // This will currently work for everything except zero sized 
-                // bitfields which we currently aren't detecting anyway from the
-                // DWARF so it should be ok for now.
-                cxx_record_decl->setEmpty (false);
-            }
-
             clang::Expr *bit_width = NULL;
             if (bitfield_bit_size != 0)
             {
@@ -970,24 +951,6 @@
             if (field)
             {
                 record_decl->addDecl(field);
-               
-                // NOTE: we currently have some fixes that should be placed
-                // into clang that will automatically set if a record is POD
-                // when each field is added (during the addDecl() method call 
-                // above) so this code should be able to come out when those 
-                // changes make it into llvm/clang, then we can remove this 
-                // code...
-                // Currently SEMA is using the accessors manually to set 
-                // whether a class is empty, is POD, is aggregate, and more.
-                // This code will be moved into CXXRecordDecl so everyone
-                // can benefit.
- 
-                if (cxx_record_decl->isPOD())
-                {
-                    if (!field->getType()->isPODType())
-                        cxx_record_decl->setPOD (false);
-                    return true;
-                }
             }
         }
         else
@@ -1138,47 +1101,6 @@
                 if (cxx_record_decl)
                 {
                     cxx_record_decl->setBases(base_classes, num_base_classes);
-                    
-                    // NOTE: we currently have some fixes that should be placed
-                    // into clang that will automatically set these things when
-                    // they are added (during the setBases() method call above)
-                    // so this code should be able to come out when those changes
-                    // make it into llvm/clang, then we can remove this code...
-                    // Currently SEMA is using the accessors manually to set 
-                    // whether a class is empty, is POD, is aggregate, and more.
-                    // This code will be moved into CXXRecordDecl so everyone
-                    // can benefit.
-                    if (cxx_record_decl->isEmpty() || cxx_record_decl->isPOD())
-                    {
-                        // set empty to false if any bases are virtual, or not empty.
-                    
-                        CXXRecordDecl::base_class_const_iterator base_class, base_class_end;
-                        for (base_class = cxx_record_decl->bases_begin(), base_class_end = cxx_record_decl->bases_end();
-                             base_class != base_class_end;
-                             ++base_class)
-                        {
-                            if (base_class->isVirtual())
-                            {
-                                cxx_record_decl->setEmpty (false);
-                                cxx_record_decl->setPOD (false);
-                                break;
-                            }
-                            else
-                            {
-                                QualType base_type (base_class->getType());
-                                
-                                if (!base_type->isPODType())
-                                    cxx_record_decl->setPOD (false);
-
-                                const CXXRecordDecl *base_class_decl = cast<CXXRecordDecl>(base_type->getAs<RecordType>()->getDecl());
-                                if (!base_class_decl->isEmpty())
-                                {
-                                    cxx_record_decl->setEmpty (false);
-                                    break;
-                                }
-                            }
-                        }
-                    }
                     return true;
                 }
             }
@@ -2892,18 +2814,31 @@
     if (clang_type)
     {
         QualType qual_type (QualType::getFromOpaquePtr(clang_type));
-        clang::Type *t = qual_type.getTypePtr();
-        if (t)
+        
+        CXXRecordDecl *cxx_record_decl = qual_type->getAsCXXRecordDecl();
+        
+        if (cxx_record_decl)
         {
-            TagType *tag_type = dyn_cast<TagType>(t);
-            if (tag_type)
+            cxx_record_decl->completeDefinition();
+            
+            return true;
+        }
+        
+        const EnumType *enum_type = dyn_cast<EnumType>(qual_type.getTypePtr());
+        
+        if (enum_type)
+        {
+            EnumDecl *enum_decl = enum_type->getDecl();
+            
+            if (enum_decl)
             {
-                TagDecl *tag_decl = tag_type->getDecl();
-                if (tag_decl)
-                {
-                    tag_decl->completeDefinition();
-                    return true;
-                }
+                /// TODO This really needs to be fixed.
+                
+                unsigned NumPositiveBits = 1;
+                unsigned NumNegativeBits = 0;
+                
+                enum_decl->completeDefinition(enum_decl->getIntegerType(), enum_decl->getIntegerType(), NumPositiveBits, NumNegativeBits);
+                return true;
             }
         }
     }





More information about the lldb-commits mailing list