[Lldb-commits] [lldb] r264753 - Don't try to call getTypeSize() on a class if it isn't complete as clang will assert and kill the process.

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Tue Mar 29 10:36:38 PDT 2016


Author: gclayton
Date: Tue Mar 29 12:36:38 2016
New Revision: 264753

URL: http://llvm.org/viewvc/llvm-project?rev=264753&view=rev
Log:
Don't try to call getTypeSize() on a class if it isn't complete as clang will assert and kill the process.

Modified:
    lldb/trunk/source/Symbol/ClangASTContext.cpp

Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=264753&r1=264752&r2=264753&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Tue Mar 29 12:36:38 2016
@@ -4674,8 +4674,16 @@ ClangASTContext::GetBitSize (lldb::opaqu
     if (GetCompleteType (type))
     {
         clang::QualType qual_type(GetCanonicalQualType(type));
-        switch (qual_type->getTypeClass())
+        const clang::Type::TypeClass type_class = qual_type->getTypeClass();
+        switch (type_class)
         {
+            case clang::Type::Record:
+                if (GetCompleteType(type))
+                    return getASTContext()->getTypeSize(qual_type);
+                else
+                    return 0;
+                break;
+
             case clang::Type::ObjCInterface:
             case clang::Type::ObjCObject:
             {




More information about the lldb-commits mailing list