Change ValueObject::IsLogicalTrue so that it starts by asking the applicable Language plugin before using the C-style rule

llvm-svn: 251838
This commit is contained in:
Enrico Granata 2015-11-02 21:52:05 +00:00
parent b1d4a39990
commit 407b5c62ba
3 changed files with 26 additions and 0 deletions

View File

@ -119,6 +119,10 @@ public:
virtual DumpValueObjectOptions::DeclPrintingHelper
GetDeclPrintingHelper ();
virtual LazyBool
IsLogicalTrue (ValueObject& valobj,
Error& error);
// These are accessors for general information about the Languages lldb knows about:
static lldb::LanguageType

View File

@ -47,6 +47,7 @@
#include "lldb/Symbol/Type.h"
#include "lldb/Target/ExecutionContext.h"
#include "lldb/Target/Language.h"
#include "lldb/Target/LanguageRuntime.h"
#include "lldb/Target/ObjCLanguageRuntime.h"
#include "lldb/Target/Process.h"
@ -515,6 +516,20 @@ ValueObject::ResolveValue (Scalar &scalar)
bool
ValueObject::IsLogicalTrue (Error& error)
{
if (Language *language = Language::FindPlugin(GetObjectRuntimeLanguage()))
{
LazyBool is_logical_true = language->IsLogicalTrue(*this, error);
switch (is_logical_true)
{
case eLazyBoolYes:
case eLazyBoolNo:
return (is_logical_true == true);
case eLazyBoolCalculate:
default:
break;
}
}
Scalar scalar_value;
if (!ResolveValue (scalar_value))

View File

@ -351,6 +351,13 @@ Language::GetDeclPrintingHelper ()
return nullptr;
}
LazyBool
Language::IsLogicalTrue (ValueObject& valobj,
Error& error)
{
return eLazyBoolCalculate;
}
//----------------------------------------------------------------------
// Constructor
//----------------------------------------------------------------------