summaryrefslogtreecommitdiffstats
path: root/lldb/source/Commands
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Commands')
-rw-r--r--lldb/source/Commands/CommandObjectArgs.cpp13
-rw-r--r--lldb/source/Commands/CommandObjectMemory.cpp12
-rw-r--r--lldb/source/Commands/CommandObjectVersion.cpp12
-rw-r--r--lldb/source/Commands/CommandObjectVersion.h2
-rw-r--r--lldb/source/Commands/CommandObjectWatchpoint.cpp12
5 files changed, 28 insertions, 23 deletions
diff --git a/lldb/source/Commands/CommandObjectArgs.cpp b/lldb/source/Commands/CommandObjectArgs.cpp
index b2b4cdff13c..05fd53bbe89 100644
--- a/lldb/source/Commands/CommandObjectArgs.cpp
+++ b/lldb/source/Commands/CommandObjectArgs.cpp
@@ -164,7 +164,7 @@ CommandObjectArgs::DoExecute (Args& args, CommandReturnObject &result)
const char *arg_type_cstr = args.GetArgumentAtIndex(arg_index);
Value value;
value.SetValueType(Value::eValueTypeScalar);
- void *type;
+ ClangASTType clang_type;
char *int_pos;
if ((int_pos = strstr (const_cast<char*>(arg_type_cstr), "int")))
@@ -207,9 +207,9 @@ CommandObjectArgs::DoExecute (Args& args, CommandReturnObject &result)
return false;
}
- type = ast_context.GetBuiltinTypeForEncodingAndBitSize(encoding, width);
+ clang_type = ast_context.GetBuiltinTypeForEncodingAndBitSize(encoding, width);
- if (!type)
+ if (!clang_type.IsValid())
{
result.AppendErrorWithFormat ("Couldn't get Clang type for format %s (%s integer, width %d).\n",
arg_type_cstr,
@@ -223,9 +223,9 @@ CommandObjectArgs::DoExecute (Args& args, CommandReturnObject &result)
else if (strchr (arg_type_cstr, '*'))
{
if (!strcmp (arg_type_cstr, "void*"))
- type = ast_context.CreatePointerType (ast_context.GetBuiltInType_void ());
+ clang_type = ast_context.GetBasicType(eBasicTypeVoid).GetPointerType();
else if (!strcmp (arg_type_cstr, "char*"))
- type = ast_context.GetCStringType (false);
+ clang_type = ast_context.GetCStringType (false);
else
{
result.AppendErrorWithFormat ("Invalid format: %s.\n", arg_type_cstr);
@@ -240,8 +240,7 @@ CommandObjectArgs::DoExecute (Args& args, CommandReturnObject &result)
return false;
}
- value.SetContext (Value::eContextTypeClangType, type);
-
+ value.SetClangType (clang_type);
value_list.PushValue(value);
}
diff --git a/lldb/source/Commands/CommandObjectMemory.cpp b/lldb/source/Commands/CommandObjectMemory.cpp
index 97ab957ff73..eea0cf5001f 100644
--- a/lldb/source/Commands/CommandObjectMemory.cpp
+++ b/lldb/source/Commands/CommandObjectMemory.cpp
@@ -543,15 +543,15 @@ protected:
else
{
TypeSP type_sp (type_list.GetTypeAtIndex(0));
- clang_ast_type.SetClangType (type_sp->GetClangAST(), type_sp->GetClangFullType());
+ clang_ast_type = type_sp->GetClangFullType();
}
}
while (pointer_count > 0)
{
- clang_type_t pointer_type = ClangASTContext::CreatePointerType (clang_ast_type.GetASTContext(), clang_ast_type.GetOpaqueQualType());
- if (pointer_type)
- clang_ast_type.SetClangType (clang_ast_type.GetASTContext(), pointer_type);
+ ClangASTType pointer_type = clang_ast_type.GetPointerType();
+ if (pointer_type.IsValid())
+ clang_ast_type = pointer_type;
else
{
result.AppendError ("unable make a pointer type\n");
@@ -561,7 +561,7 @@ protected:
--pointer_count;
}
- m_format_options.GetByteSizeValue() = clang_ast_type.GetClangTypeByteSize();
+ m_format_options.GetByteSizeValue() = clang_ast_type.GetByteSize();
if (m_format_options.GetByteSizeValue() == 0)
{
@@ -675,7 +675,7 @@ protected:
if (m_format_options.GetFormatValue().OptionWasSet() == false)
m_format_options.GetFormatValue().SetCurrentValue(eFormatDefault);
- bytes_read = clang_ast_type.GetTypeByteSize() * m_format_options.GetCountValue().GetCurrentValue();
+ bytes_read = clang_ast_type.GetByteSize() * m_format_options.GetCountValue().GetCurrentValue();
}
else if (m_format_options.GetFormatValue().GetCurrentValue() != eFormatCString)
{
diff --git a/lldb/source/Commands/CommandObjectVersion.cpp b/lldb/source/Commands/CommandObjectVersion.cpp
index ea1930e0ffd..2d950a89c9b 100644
--- a/lldb/source/Commands/CommandObjectVersion.cpp
+++ b/lldb/source/Commands/CommandObjectVersion.cpp
@@ -38,8 +38,16 @@ CommandObjectVersion::~CommandObjectVersion ()
bool
CommandObjectVersion::DoExecute (Args& args, CommandReturnObject &result)
{
- result.AppendMessageWithFormat ("%s\n", lldb_private::GetVersion());
- result.SetStatus (eReturnStatusSuccessFinishResult);
+ if (args.GetArgumentCount() == 0)
+ {
+ result.AppendMessageWithFormat ("%s\n", lldb_private::GetVersion());
+ result.SetStatus (eReturnStatusSuccessFinishResult);
+ }
+ else
+ {
+ result.AppendError("the version command takes no arguments.");
+ result.SetStatus (eReturnStatusFailed);
+ }
return true;
}
diff --git a/lldb/source/Commands/CommandObjectVersion.h b/lldb/source/Commands/CommandObjectVersion.h
index 035c65e6674..1fdbed60c65 100644
--- a/lldb/source/Commands/CommandObjectVersion.h
+++ b/lldb/source/Commands/CommandObjectVersion.h
@@ -34,7 +34,7 @@ public:
protected:
virtual bool
DoExecute (Args& args,
- CommandReturnObject &result);
+ CommandReturnObject &result);
};
diff --git a/lldb/source/Commands/CommandObjectWatchpoint.cpp b/lldb/source/Commands/CommandObjectWatchpoint.cpp
index 7a6a47e60d0..c1f0c41e34f 100644
--- a/lldb/source/Commands/CommandObjectWatchpoint.cpp
+++ b/lldb/source/Commands/CommandObjectWatchpoint.cpp
@@ -1050,7 +1050,7 @@ protected:
valobj_sp = valobj_list.GetValueObjectAtIndex(0);
}
- ClangASTType type;
+ ClangASTType clang_type;
if (valobj_sp)
{
@@ -1063,7 +1063,7 @@ protected:
size = m_option_watchpoint.watch_size == 0 ? valobj_sp->GetByteSize()
: m_option_watchpoint.watch_size;
}
- type.SetClangType(valobj_sp->GetClangAST(), valobj_sp->GetClangType());
+ clang_type = valobj_sp->GetClangType();
}
else
{
@@ -1080,7 +1080,7 @@ protected:
uint32_t watch_type = m_option_watchpoint.watch_type;
error.Clear();
- Watchpoint *wp = target->CreateWatchpoint(addr, size, &type, watch_type, error).get();
+ Watchpoint *wp = target->CreateWatchpoint(addr, size, &clang_type, watch_type, error).get();
if (wp)
{
wp->SetWatchSpec(command.GetArgumentAtIndex(0));
@@ -1292,12 +1292,10 @@ protected:
// Fetch the type from the value object, the type of the watched object is the pointee type
/// of the expression, so convert to that if we found a valid type.
- ClangASTType type(valobj_sp->GetClangAST(), valobj_sp->GetClangType());
- if (type.IsValid())
- type.SetClangType(type.GetASTContext(), type.GetPointeeType());
+ ClangASTType clang_type(valobj_sp->GetClangType());
Error error;
- Watchpoint *wp = target->CreateWatchpoint(addr, size, &type, watch_type, error).get();
+ Watchpoint *wp = target->CreateWatchpoint(addr, size, &clang_type, watch_type, error).get();
if (wp)
{
Stream &output_stream = result.GetOutputStream();
OpenPOWER on IntegriCloud