forked from OSchip/llvm-project
[lldb] Use llvm::format in AppleObjCRuntimeV2.cpp
Crushing a "sprintf" buffer is null warning.
This commit is contained in:
parent
64225aea8f
commit
290e43ddb6
|
@ -1625,19 +1625,13 @@ AppleObjCRuntimeV2::UpdateISAToDescriptorMapSharedCache() {
|
|||
// Substitute in the correct class_getName / class_getNameRaw function name,
|
||||
// concatenate the two parts of our expression text. The format string
|
||||
// has two %s's, so provide the name twice.
|
||||
int prefix_string_size = snprintf (nullptr, 0,
|
||||
std::string shared_class_expression;
|
||||
llvm::raw_string_ostream(shared_class_expression) << llvm::format(
|
||||
g_shared_cache_class_name_funcptr,
|
||||
class_name_getter_function_name.AsCString(),
|
||||
class_name_getter_function_name.AsCString());
|
||||
|
||||
char *class_name_func_ptr_expr = (char*) malloc (prefix_string_size + 1);
|
||||
snprintf (class_name_func_ptr_expr, prefix_string_size + 1,
|
||||
g_shared_cache_class_name_funcptr,
|
||||
class_name_getter_function_name.AsCString(),
|
||||
class_name_getter_function_name.AsCString());
|
||||
std::string shared_class_expression = class_name_func_ptr_expr;
|
||||
shared_class_expression += g_get_shared_cache_class_info_body;
|
||||
free (class_name_func_ptr_expr);
|
||||
|
||||
m_get_shared_cache_class_info_code.reset(
|
||||
GetTargetRef().GetUtilityFunctionForLanguage(
|
||||
|
|
Loading…
Reference in New Issue