From 57ee306789ba68992d537a65b3f107eadd18db2d Mon Sep 17 00:00:00 2001 From: Greg Clayton Date: Thu, 11 Jul 2013 22:46:58 +0000 Subject: Huge change to clean up types. A long time ago we start with clang types that were created by the symbol files and there were many functions in lldb_private::ClangASTContext that helped. Later we create ClangASTType which contains a clang::ASTContext and an opauque QualType, but we didn't switch over to fully using it. There were a lot of places where we would pass around a raw clang_type_t and also pass along a clang::ASTContext separately. This left room for error. This checkin change all type code over to use ClangASTType everywhere and I cleaned up the interfaces quite a bit. Any code that was in ClangASTContext that was type related, was moved over into ClangASTType. All code that used these types was switched over to use all of the new goodness. llvm-svn: 186130 --- lldb/source/Commands/CommandObjectArgs.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'lldb/source/Commands/CommandObjectArgs.cpp') diff --git a/lldb/source/Commands/CommandObjectArgs.cpp b/lldb/source/Commands/CommandObjectArgs.cpp index b2b4cdf..05fd53b 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(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); } -- cgit v1.1