<rdar://problem/12462744> Implement a new SBDeclaration class to wrap an lldb_private::Declaration - make a GetDeclaration() API on SBValue to return a declaration. This will only work for vroot variables as they are they only objects for which we currently provide a valid Declaration
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@165672 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/API/SBValue.cpp b/source/API/SBValue.cpp
index 3f2a379..913a447 100644
--- a/source/API/SBValue.cpp
+++ b/source/API/SBValue.cpp
@@ -9,6 +9,7 @@
#include "lldb/API/SBValue.h"
+#include "lldb/API/SBDeclaration.h"
#include "lldb/API/SBStream.h"
#include "lldb/API/SBTypeFilter.h"
#include "lldb/API/SBTypeFormat.h"
@@ -28,6 +29,7 @@
#include "lldb/Core/ValueObject.h"
#include "lldb/Core/ValueObjectConstResult.h"
#include "lldb/Symbol/Block.h"
+#include "lldb/Symbol/Declaration.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Symbol/Type.h"
#include "lldb/Symbol/Variable.h"
@@ -1694,6 +1696,20 @@
return sb_data;
}
+lldb::SBDeclaration
+SBValue::GetDeclaration ()
+{
+ lldb::ValueObjectSP value_sp(GetSP());
+ SBDeclaration decl_sb;
+ if (value_sp)
+ {
+ Declaration decl;
+ if (value_sp->GetDeclaration(decl))
+ decl_sb.SetDeclaration(decl);
+ }
+ return decl_sb;
+}
+
lldb::SBWatchpoint
SBValue::Watch (bool resolve_location, bool read, bool write, SBError &error)
{