Index: include/lldb/API/SBExpressionOptions.h
===================================================================
--- include/lldb/API/SBExpressionOptions.h	(revision 218238)
+++ include/lldb/API/SBExpressionOptions.h	(working copy)
@@ -118,6 +118,8 @@
     friend class SBFrame;
     friend class SBValue;
     friend class SBTarget;
+    friend class SBTypeMemberFunction;
+    friend class SBFunction;
 
 private:
     // This auto_pointer is made in the constructor and is always valid.
Index: include/lldb/API/SBFrame.h
===================================================================
--- include/lldb/API/SBFrame.h	(revision 218238)
+++ include/lldb/API/SBFrame.h	(working copy)
@@ -198,21 +198,6 @@
     lldb::SBValue
     FindValue (const char *name, ValueType value_type, lldb::DynamicValueType use_dynamic);
 
-    /// Find and watch a variable using the frame as the scope.
-    /// It returns an SBValue, similar to FindValue() method, if find-and-watch
-    /// operation succeeds.  Otherwise, an invalid SBValue is returned.
-    /// You can use LLDB_WATCH_TYPE_READ | LLDB_WATCH_TYPE_WRITE for 'rw' watch.
-    lldb::SBValue
-    WatchValue (const char *name, ValueType value_type, uint32_t watch_type);
-
-    /// Find and watch the location pointed to by a variable using the frame as
-    /// the scope.
-    /// It returns an SBValue, similar to FindValue() method, if find-and-watch
-    /// operation succeeds.  Otherwise, an invalid SBValue is returned.
-    /// You can use LLDB_WATCH_TYPE_READ | LLDB_WATCH_TYPE_WRITE for 'rw' watch.
-    lldb::SBValue
-    WatchLocation (const char *name, ValueType value_type, uint32_t watch_type, size_t size);
-
     bool
     GetDescription (lldb::SBStream &description);
 
@@ -224,6 +209,8 @@
     friend class SBInstruction;
     friend class SBThread;
     friend class SBValue;
+    friend class SBTypeMemberFunction;
+    friend class SBFunction;
 #ifndef LLDB_DISABLE_PYTHON
     friend class lldb_private::ScriptInterpreterPython;
 #endif
Index: include/lldb/API/SBFunction.h
===================================================================
--- include/lldb/API/SBFunction.h	(revision 218238)
+++ include/lldb/API/SBFunction.h	(working copy)
@@ -68,6 +68,11 @@
     bool
     GetDescription (lldb::SBStream &description);
 
+    lldb::SBValue ExecuteFunction(lldb::SBFrame &frame,
+                                  lldb::SBValueList arguments,
+                                  lldb::SBStream &errors,
+                                  lldb::SBExpressionOptions options,
+                                  bool reusable);
 protected:
 
     lldb_private::Function *
Index: include/lldb/API/SBType.h
===================================================================
--- include/lldb/API/SBType.h	(revision 218238)
+++ include/lldb/API/SBType.h	(working copy)
@@ -104,7 +104,15 @@
     bool
     GetDescription (lldb::SBStream &description,
                     lldb::DescriptionLevel description_level);
-    
+
+    lldb::SBValue ExecuteFunction(lldb::SBFrame &frame,
+                                  lldb::SBValue self,
+                                  lldb::SBValueList arguments,
+                                  lldb::SBStream &errors,
+                                  lldb::SBExpressionOptions options,
+                                  bool reusable);
+
+    void RemoveReusableFunction();
 protected:
     friend class SBType;
     
Index: include/lldb/API/SBValueList.h
===================================================================
--- include/lldb/API/SBValueList.h	(revision 218238)
+++ include/lldb/API/SBValueList.h	(working copy)
@@ -59,6 +59,7 @@
 
 private:
     friend class SBFrame;
+    friend class SBTypeMemberFunction;
     
     SBValueList (const ValueListImpl *lldb_object_ptr);
 
Index: include/lldb/Expression/ClangFunction.h
===================================================================
--- include/lldb/Expression/ClangFunction.h	(revision 218238)
+++ include/lldb/Expression/ClangFunction.h	(working copy)
@@ -406,6 +406,12 @@
     {
         return m_arg_values;
     }
+
+    Address
+    GetFunctionAddress() const
+    {
+        return m_function_addr;
+    }
 private:
     //------------------------------------------------------------------
     // For ClangFunction only
Index: include/lldb/Symbol/Function.h
===================================================================
--- include/lldb/Symbol/Function.h	(revision 218238)
+++ include/lldb/Symbol/Function.h	(working copy)
@@ -17,6 +17,7 @@
 #include "lldb/Expression/DWARFExpression.h"
 #include "lldb/Core/Mangled.h"
 #include "lldb/Core/UserID.h"
+#include "lldb/Expression/ClangFunction.h"
 
 namespace lldb_private {
 
@@ -619,6 +620,12 @@
                     bool prefer_file_cache,
                     Stream &strm);
 
+    void RemoveClangFunction();
+
+    ClangFunction* GetClangFunction() const;
+
+    void SetClangFunction(ClangFunction* value);
+
 protected:
 
     enum
@@ -640,6 +647,7 @@
     DWARFExpression m_frame_base;   ///< The frame base expression for variables that are relative to the frame pointer.
     Flags m_flags;
     uint32_t m_prologue_byte_size;  ///< Compute the prologue size once and cache it
+    std::unique_ptr<ClangFunction> m_function;
 private:
     DISALLOW_COPY_AND_ASSIGN(Function);
 };
Index: include/lldb/Symbol/Type.h
===================================================================
--- include/lldb/Symbol/Type.h	(revision 218238)
+++ include/lldb/Symbol/Type.h	(working copy)
@@ -16,6 +16,7 @@
 #include "lldb/Core/UserID.h"
 #include "lldb/Symbol/ClangASTType.h"
 #include "lldb/Symbol/Declaration.h"
+#include "lldb/Expression/ClangFunction.h"
 
 #include "llvm/ADT/APSInt.h"
 
@@ -876,6 +877,12 @@
     
     bool
     GetDescription (Stream& stream);
+
+    void RemoveClangFunction ();
+
+    ClangFunction* GetClangFunction () const;
+
+    void SetClangFunction (ClangFunction* value);
     
 protected:
     std::string
@@ -886,6 +893,7 @@
     clang::ObjCMethodDecl *m_objc_method_decl;
     ConstString m_name;
     lldb::MemberFunctionKind m_kind;
+    std::unique_ptr<ClangFunction> m_function;
 };
 
 class TypeEnumMemberImpl
Index: include/lldb/Target/Target.h
===================================================================
--- include/lldb/Target/Target.h	(revision 218238)
+++ include/lldb/Target/Target.h	(working copy)
@@ -1345,6 +1345,8 @@
     lldb::SearchFilterSP
     GetSearchFilterForModuleAndCUList (const FileSpecList *containingModules, const FileSpecList *containingSourceFiles);
 
+    uint64_t GetSelectorFor(StackFrame* frame, const ConstString& value);
+
 protected:
     //------------------------------------------------------------------
     // Member variables.
@@ -1372,6 +1374,8 @@
     ClangPersistentVariables m_persistent_variables;      ///< These are the persistent variables associated with this process for the expression parser.
 
     std::unique_ptr<SourceManager> m_source_manager_ap;
+    
+    std::map<ConstString, uint64_t> m_selector_map;
 
     typedef std::map<lldb::user_id_t, StopHookSP> StopHookCollection;
     StopHookCollection      m_stop_hooks;
Index: source/API/SBFunction.cpp
===================================================================
--- source/API/SBFunction.cpp	(revision 218238)
+++ source/API/SBFunction.cpp	(working copy)
@@ -18,6 +18,11 @@
 #include "lldb/Symbol/Type.h"
 #include "lldb/Target/ExecutionContext.h"
 #include "lldb/Target/Target.h"
+#include "lldb/API/SBExpressionOptions.h"
+#include "lldb/Core/ValueObjectConstResult.h"
+#include "lldb/API/SBFrame.h"
+#include "lldb/Target/Thread.h"
+#include "lldb/Target/ExecutionContext.h"
 
 using namespace lldb;
 using namespace lldb_private;
@@ -229,3 +234,75 @@
 
 
 
+lldb::SBValue SBFunction::ExecuteFunction(lldb::SBFrame &frame,
+    lldb::SBValueList arguments,
+    lldb::SBStream &errors,
+    lldb::SBExpressionOptions options,
+    bool reusable)
+{
+    if (!m_opaque_ptr)
+    {
+        errors->PutCString("no value");
+        return SBValue();
+    }
+
+    ExecutionContext exe_ctx = frame.GetFrameSP();
+
+    if (!exe_ctx.GetFrameSP())
+    {
+        errors->PutCString("no frame");
+        return SBValue();
+    }
+
+    ClangFunction* func = m_opaque_ptr->GetClangFunction();
+
+    ValueList args;
+    for (int i = 0; i < arguments.GetSize(); i++)
+    {
+        const ValueObjectSP value = arguments.GetValueAtIndex(i).GetSP();
+        value->UpdateValueIfNeeded();
+        args.PushValue(value->GetValue());
+    }
+    //arguments.
+    Thread& thread = *exe_ctx.GetThreadSP();
+
+    if (!func)
+    {
+        func = new ClangFunction(thread,
+            m_opaque_ptr->GetClangType().GetFunctionReturnType(),
+            m_opaque_ptr->GetAddressRange().GetBaseAddress(),
+            args,
+            m_opaque_ptr->GetName().GetCString());
+        m_opaque_ptr->SetClangFunction(func);
+
+        if (func->CompileFunction(*errors.get()))
+            return SBValue();
+
+        if (!func->WriteFunctionWrapper(exe_ctx, *errors.get()))
+            return SBValue();
+    }
+    errors.Clear();
+
+    lldb::addr_t args_addr = LLDB_INVALID_ADDRESS;
+    if (!func->WriteFunctionArguments(exe_ctx, args_addr,
+        func->GetFunctionAddress(), args, *errors.get()))
+    {
+        return SBValue();
+    }
+
+    Value res;
+    if (func->ExecuteFunction(exe_ctx, &args_addr, *options.get(), *errors.get(), res))
+    {
+        func->DeallocateFunctionResults(exe_ctx, args_addr);
+        if (!reusable)
+            m_opaque_ptr->RemoveClangFunction();
+        return SBValue();
+    }
+
+    SBValue results = ValueObjectConstResult::Create(&thread, res, ConstString("<evaluation result>"));
+
+    func->DeallocateFunctionResults(exe_ctx, args_addr);
+    if (!reusable)
+        m_opaque_ptr->RemoveClangFunction();
+    return results;
+}
\ No newline at end of file
Index: source/API/SBType.cpp
===================================================================
--- source/API/SBType.cpp	(revision 218238)
+++ source/API/SBType.cpp	(working copy)
@@ -17,6 +17,19 @@
 #include "lldb/Symbol/ClangASTContext.h"
 #include "lldb/Symbol/ClangASTType.h"
 #include "lldb/Symbol/Type.h"
+#include "lldb/API/SBValue.h"
+#include "lldb/API/SBValueList.h"
+#include "lldb/API/SBExpressionOptions.h"
+#include "lldb/API/SBError.h"
+#include "lldb/API/SBFrame.h"
+#include "lldb/Expression/ClangFunction.h"
+#include "lldb/Target/ExecutionContext.h"
+#include "lldb/API/SBValueList.h"
+#include "lldb/Target/Thread.h"
+#include "lldb/Core/ValueObject.h"
+#include "lldb/Core/ValueObjectConstResult.h"
+#include "lldb/Target/Target.h"
+#include "lldb/Symbol/Symbol.h"
 
 #include "clang/AST/Decl.h"
 
@@ -821,3 +834,108 @@
 {
     return *m_opaque_sp.get();
 }
+
+void SBTypeMemberFunction::RemoveReusableFunction()
+{
+    if (m_opaque_sp)
+        m_opaque_sp.get()->RemoveClangFunction();
+}
+
+lldb::SBValue SBTypeMemberFunction::ExecuteFunction(lldb::SBFrame &frame,
+    lldb::SBValue self,
+    lldb::SBValueList arguments,
+    lldb::SBStream &errors,
+    lldb::SBExpressionOptions options,
+    bool reusable)
+{
+    if (!m_opaque_sp) 
+    {
+        errors->PutCString ("no value");
+        return SBValue();
+    }
+    if (!self.IsValid())
+    {
+        errors->PutCString ("No self");
+        return SBValue();
+    }
+    
+    ExecutionContext exe_ctx = frame.GetFrameSP();
+
+    if (!exe_ctx.GetFrameSP())
+    {
+        errors->PutCString ("no frame");
+        return SBValue();
+    }
+
+    TypeMemberFunctionImpl& val = *m_opaque_sp.get();
+    ClangFunction* func = val.GetClangFunction();
+    Target &target = frame.GetFrameSP().get()->GetThread()->GetProcess()->GetTarget();
+
+    ValueList args;
+    ClangASTContext* ast = target.GetScratchClangASTContext();
+    ClangASTType pointertype = ast->GetCStringType(true);
+    ValueObjectSP selfptr = self.GetSP()->Cast(pointertype);
+    selfptr->UpdateValueIfNeeded();
+    args.PushValue(selfptr->GetValue());
+    
+    uint64_t sel = target.GetSelectorFor(frame.GetFrameSP().get(), ConstString(m_opaque_sp->GetName()));
+    Value selectorvalue(ast->GetPointerByteSize() == 4 ? Scalar((uint32_t)sel) : Scalar(sel));
+    selectorvalue.SetClangType(pointertype);
+    args.PushValue(selectorvalue);
+
+
+    for (int i = 0; i < arguments.GetSize(); i++)  {
+        const ValueObjectSP value = arguments.GetValueAtIndex(i).GetSP();
+        value->UpdateValueIfNeeded();
+        args.PushValue(value->GetValue());
+    }
+    
+    Thread& thread = *exe_ctx.GetThreadSP();
+
+    if (!func)
+    {
+        SymbolContextList sclist;
+        target.GetImages().FindFunctions(ConstString("objc_msgSend"), eFunctionNameTypeAny, 
+                                         true, false, true, sclist);
+        if (!sclist.GetSize()) {
+            errors->PutCString("Cannot find msgSend");
+            return SBValue();
+        }
+        Address* msgsend_address = &sclist[0].symbol->GetAddress();
+        func = new ClangFunction (thread,
+                                  m_opaque_sp->GetReturnType (),
+                                  *msgsend_address,
+                                  args,
+                                  m_opaque_sp->GetName ().GetCString());
+
+        if (func->CompileFunction(*errors.get()))
+            return SBValue();
+
+        if (!func->WriteFunctionWrapper(exe_ctx, *errors.get()))
+            return SBValue();
+
+        val.SetClangFunction(func);
+    }
+    errors.Clear();
+        
+    lldb::addr_t args_addr = LLDB_INVALID_ADDRESS;
+    if (!func->WriteFunctionArguments(exe_ctx, args_addr,
+        func->GetFunctionAddress(), args, *errors.get()))
+    {
+        return SBValue();
+    }
+        
+    Value res;
+    if (func->ExecuteFunction(exe_ctx, &args_addr, *options.get(), *errors.get(), res))
+    {
+        func->DeallocateFunctionResults(exe_ctx, args_addr);
+        if (!reusable)
+            val.RemoveClangFunction();
+        return SBValue();
+    }
+
+    func->DeallocateFunctionResults(exe_ctx, args_addr);
+    if (!reusable)
+        val.RemoveClangFunction();
+    return ValueObjectConstResult::Create(&thread, res, ConstString("<evaluation result>"));
+}
Index: source/Expression/ClangFunction.cpp
===================================================================
--- source/Expression/ClangFunction.cpp	(revision 218238)
+++ source/Expression/ClangFunction.cpp	(working copy)
@@ -126,7 +126,7 @@
     // FIXME: How does clang tell us there's no return value?  We need to handle that case.
     unsigned num_errors = 0;
     
-    std::string return_type_str (m_function_return_type.GetTypeName().AsCString(""));
+    std::string return_type_str (m_function_return_type.GetCanonicalType().GetTypeName().AsCString(""));
     
     // Cons up the function we're going to wrap our call in, then compile it...
     // We declare the function "extern "C"" because the compiler might be in C++
@@ -177,11 +177,11 @@
 
         if (trust_function)
         {
-            type_name = function_clang_type.GetFunctionArgumentTypeAtIndex(i).GetTypeName().AsCString("");
+            type_name = function_clang_type.GetFunctionArgumentTypeAtIndex(i).GetCanonicalType().GetTypeName().AsCString("");
         }
         else
         {
-            ClangASTType clang_qual_type = m_arg_values.GetValueAtIndex(i)->GetClangType ();
+            ClangASTType clang_qual_type = m_arg_values.GetValueAtIndex(i)->GetClangType().GetCanonicalType();
             if (clang_qual_type)
             {
                 type_name = clang_qual_type.GetTypeName().AsCString("");
Index: source/Symbol/Function.cpp
===================================================================
--- source/Symbol/Function.cpp	(revision 218238)
+++ source/Symbol/Function.cpp	(working copy)
@@ -602,5 +602,18 @@
     return m_prologue_byte_size;
 }
 
+void Function::RemoveClangFunction()
+{
+    m_function.reset();
+}
 
+ClangFunction* Function::GetClangFunction() const
+{
+    return m_function.get();
+}
 
+void Function::SetClangFunction(ClangFunction* value)
+{
+    m_function.reset(value);
+}
+
Index: source/Symbol/Type.cpp
===================================================================
--- source/Symbol/Type.cpp	(revision 218238)
+++ source/Symbol/Type.cpp	(working copy)
@@ -27,6 +27,7 @@
 #include "lldb/Target/ExecutionContext.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/Target.h"
+#include "lldb/Expression/ClangFunction.h"
 
 #include "llvm/ADT/StringRef.h"
 
@@ -1403,6 +1404,22 @@
     return ClangASTType();
 }
 
+void TypeMemberFunctionImpl::RemoveClangFunction ()
+{
+    m_function.reset();
+}
+
+ClangFunction* TypeMemberFunctionImpl::GetClangFunction() const
+{
+    return m_function.get();
+}
+
+void TypeMemberFunctionImpl::SetClangFunction(ClangFunction* value)
+{
+    m_function.reset(value);
+}
+
+
 TypeEnumMemberImpl::TypeEnumMemberImpl (const clang::EnumConstantDecl* enum_member_decl,
                                         const lldb_private::ClangASTType& integer_type) :
     m_integer_type_sp(),
@@ -1419,3 +1436,6 @@
         m_valid = true;
     }
 }
+
+
+
Index: source/Target/Target.cpp
===================================================================
--- source/Target/Target.cpp	(revision 218238)
+++ source/Target/Target.cpp	(working copy)
@@ -49,6 +49,7 @@
 #include "lldb/Target/SystemRuntime.h"
 #include "lldb/Target/Thread.h"
 #include "lldb/Target/ThreadSpec.h"
+#include "lldb/Core/ValueObjectConstResult.h"
 
 using namespace lldb;
 using namespace lldb_private;
@@ -2486,6 +2487,25 @@
     }
     return error;
 }
+
+
+uint64_t Target::GetSelectorFor(StackFrame* frame, const ConstString& value)
+{
+    auto res = m_selector_map.find(value);
+    if (res != m_selector_map.end())
+        return res->second;
+
+    ValueList args;
+    std::string selector;
+    selector = selector + "((void* (*)(char*))sel_registerName)(\"" + value.AsCString() + "\")";
+    ValueObjectSP selectorptr;
+    EvaluateExpression(selector.c_str(), frame, selectorptr);
+
+    addr_t result = selectorptr->GetValueAsUnsigned(0);
+    if (result)
+        m_selector_map[value] = result;
+    return result;
+}
 //--------------------------------------------------------------
 // Target::StopHook
 //--------------------------------------------------------------
@@ -3207,4 +3227,3 @@
     }
     return NULL;
 }
-
