Emit a warning the first time that one tries to resolve the size of a type passing...
authorEnrico Granata <egranata@apple.com>
Wed, 28 Jan 2015 01:41:00 +0000 (01:41 +0000)
committerEnrico Granata <egranata@apple.com>
Wed, 28 Jan 2015 01:41:00 +0000 (01:41 +0000)
This should help us find these cases and act on them

llvm-svn: 227289

lldb/source/Symbol/ClangASTType.cpp

index e7103fb..9095888 100644 (file)
@@ -2081,6 +2081,20 @@ ClangASTType::GetBitSize (ExecutionContext *exe_ctx) const
                             return bit_size;
                     }
                 }
+                else
+                {
+                    static bool g_printed = false;
+                    StreamString s;
+                    s.Printf("warning: trying to determine the size of type ");
+                    DumpTypeDescription(&s);
+                    s.Printf("\n without a valid ExecutionContext. this is not reliable. please file a bug against LLDB.\nbacktrace:\n");
+                    Host::Backtrace(s, 10);
+                    if (!g_printed)
+                    {
+                        printf("%s\n", s.GetData());
+                        g_printed = true;
+                    }
+                }
                 // fallthrough
             default:
                 const uint32_t bit_size = m_ast->getTypeSize (qual_type);