Convert all python objects in our API to use overload the __str__ method
instead of the __repr__. __repr__ is a function that should return an
expression that can be used to recreate an python object and we were using
it to just return a human readable string.

Fixed a crasher when using the new implementation of SBValue::Cast(SBType).

Thread hardened lldb::SBValue and lldb::SBWatchpoint and did other general
improvements to the API.

Fixed a crasher in lldb::SBValue::GetChildMemberWithName() where we didn't
correctly handle not having a target.

llvm-svn: 149743
diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp
index 60eaa3a..8767b82 100644
--- a/lldb/source/Core/ValueObject.cpp
+++ b/lldb/source/Core/ValueObject.cpp
@@ -1551,6 +1551,13 @@
     return true;
 }
 
+bool
+ValueObject::GetDeclaration (Declaration &decl)
+{
+    decl.Clear();
+    return false;
+}
+
 LanguageType
 ValueObject::GetObjectRuntimeLanguage ()
 {
@@ -3432,8 +3439,7 @@
 ValueObjectSP
 ValueObject::Cast (const ClangASTType &clang_ast_type)
 {
-    ValueObjectSP valobj_sp(new ValueObjectCast (*this, GetName(), clang_ast_type));
-    return valobj_sp;    
+    return ValueObjectCast::Create (*this, GetName(), clang_ast_type);
 }
 
 ValueObjectSP
diff --git a/lldb/source/Core/ValueObjectDynamicValue.cpp b/lldb/source/Core/ValueObjectDynamicValue.cpp
index b55d927..5ea7993 100644
--- a/lldb/source/Core/ValueObjectDynamicValue.cpp
+++ b/lldb/source/Core/ValueObjectDynamicValue.cpp
@@ -34,6 +34,14 @@
 
 using namespace lldb_private;
 
+lldb::ValueObjectSP
+ValueObjectCast::Create (ValueObject &parent, 
+                         const ConstString &name, 
+                         const ClangASTType &cast_type)
+{
+    ValueObjectCast *cast_valobj_ptr = new ValueObjectCast (parent, name, cast_type);
+    return cast_valobj_ptr->GetSP();
+}
 
 ValueObjectCast::ValueObjectCast
 (
diff --git a/lldb/source/Core/ValueObjectVariable.cpp b/lldb/source/Core/ValueObjectVariable.cpp
index 1a4a89c..181324d 100644
--- a/lldb/source/Core/ValueObjectVariable.cpp
+++ b/lldb/source/Core/ValueObjectVariable.cpp
@@ -276,3 +276,14 @@
         return m_variable_sp->GetSymbolContextScope();
     return NULL;
 }
+
+bool
+ValueObjectVariable::GetDeclaration (Declaration &decl)
+{
+    if (m_variable_sp)
+    {
+        decl = m_variable_sp->GetDeclaration();
+        return true;
+    }
+    return false;
+}