diff options
| author | Pavel Labath <pavel@labath.sk> | 2019-11-26 15:00:15 +0100 |
|---|---|---|
| committer | Pavel Labath <pavel@labath.sk> | 2019-11-26 15:04:13 +0100 |
| commit | 290e43ddb660db2e9b294e1e963222c08965d211 (patch) | |
| tree | be842400b4c3a81102034e78ebee5126088d1186 /lldb | |
| parent | 64225aea8f9ea92bd4189acceead272f498981b8 (diff) | |
| download | bcm5719-llvm-290e43ddb660db2e9b294e1e963222c08965d211.tar.gz bcm5719-llvm-290e43ddb660db2e9b294e1e963222c08965d211.zip | |
[lldb] Use llvm::format in AppleObjCRuntimeV2.cpp
Crushing a "sprintf" buffer is null warning.
Diffstat (limited to 'lldb')
| -rw-r--r-- | lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp index 9bdbef393e3..750b6ce6b0c 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp @@ -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( |

