Author: enrico
Date: Fri Sep  5 20:30:04 2014
New Revision: 217299

URL: http://llvm.org/viewvc/llvm-project?rev=217299&view=rev
Log:
Expose the ability to retrieve the result of a type validator via the SB API. 
To keep it simple, do not expose the pair, but just return a NULL string for 
success, and a non-NULL string for error; If we were to decide to expose the 
pair, we would need an SBTypeValidatorResult, which is fine, but it should come 
as part of exposing type validators through the SB API rather than as a one-off 
thing. So, KISS for now

Modified:
    lldb/trunk/include/lldb/API/SBValue.h
    lldb/trunk/scripts/Python/interface/SBValue.i
    lldb/trunk/source/API/SBValue.cpp

Modified: lldb/trunk/include/lldb/API/SBValue.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBValue.h?rev=217299&r1=217298&r2=217299&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBValue.h (original)
+++ lldb/trunk/include/lldb/API/SBValue.h Fri Sep  5 20:30:04 2014
@@ -93,6 +93,9 @@ public:
     const char *
     GetObjectDescription ();
     
+    const char *
+    GetTypeValidatorResult ();
+    
     lldb::SBValue
     GetDynamicValue (lldb::DynamicValueType use_dynamic);
     

Modified: lldb/trunk/scripts/Python/interface/SBValue.i
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBValue.i?rev=217299&r1=217298&r2=217299&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBValue.i (original)
+++ lldb/trunk/scripts/Python/interface/SBValue.i Fri Sep  5 20:30:04 2014
@@ -123,6 +123,9 @@ public:
     
     const char *
     GetObjectDescription ();
+    
+    const char *
+    GetTypeValidatorResult ();
 
     lldb::SBValue
     GetDynamicValue (lldb::DynamicValueType use_dynamic);

Modified: lldb/trunk/source/API/SBValue.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBValue.cpp?rev=217299&r1=217298&r2=217299&view=diff
==============================================================================
--- lldb/trunk/source/API/SBValue.cpp (original)
+++ lldb/trunk/source/API/SBValue.cpp Fri Sep  5 20:30:04 2014
@@ -543,6 +543,36 @@ SBValue::GetObjectDescription ()
     return cstr;
 }
 
+const char *
+SBValue::GetTypeValidatorResult ()
+{
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+    const char *cstr = NULL;
+    ValueLocker locker;
+    lldb::ValueObjectSP value_sp(GetSP(locker));
+    if (value_sp)
+    {
+        const auto& validation(value_sp->GetValidationStatus());
+        if (TypeValidatorResult::Failure == validation.first)
+        {
+            if (validation.second.empty())
+                cstr = "unknown error";
+            else
+                cstr = validation.second.c_str();
+        }
+    }
+    if (log)
+    {
+        if (cstr)
+            log->Printf ("SBValue(%p)::GetTypeValidatorResult() => \"%s\"",
+                         static_cast<void*>(value_sp.get()), cstr);
+        else
+            log->Printf ("SBValue(%p)::GetTypeValidatorResult() => NULL",
+                         static_cast<void*>(value_sp.get()));
+    }
+    return cstr;
+}
+
 SBType
 SBValue::GetType()
 {


_______________________________________________
lldb-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits

Reply via email to