Emit a warning the first time that one tries to resolve the size of a type passing a nullptr ExecutionContext - but only when it might actually make a difference

This should help us find these cases and act on them

llvm-svn: 227289
This commit is contained in:
Enrico Granata 2015-01-28 01:41:00 +00:00
parent ccd2a6d958
commit d7cb643ef0
1 changed files with 14 additions and 0 deletions

View 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);