diff options
author | Greg Clayton <gclayton@apple.com> | 2013-07-11 22:46:58 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2013-07-11 22:46:58 +0000 |
commit | 57ee306789ba68992d537a65b3f107eadd18db2d (patch) | |
tree | 2d07b653b2b2dd7dc716b0119b16842861ee9eff /lldb/source/Commands/CommandObjectArgs.cpp | |
parent | 37002ad30e7ccee79362e39e0a24c33f87efa993 (diff) | |
download | llvm-57ee306789ba68992d537a65b3f107eadd18db2d.zip llvm-57ee306789ba68992d537a65b3f107eadd18db2d.tar.gz llvm-57ee306789ba68992d537a65b3f107eadd18db2d.tar.bz2 |
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
Diffstat (limited to 'lldb/source/Commands/CommandObjectArgs.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectArgs.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
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<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); } |