diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp --- a/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp @@ -429,15 +429,10 @@ return; StringRef name = D->getName(); - - if (name.size() == 0 || name[0] != '$') + if (name.empty() || name.front() != '$') return; - Log *log = GetLog(LLDBLog::Expressions); - - ConstString name_cs(name.str().c_str()); - - LLDB_LOGF(log, "Recording persistent type %s\n", name_cs.GetCString()); + LLDB_LOG(GetLog(LLDBLog::Expressions), "Recording persistent type {0}", name); m_decls.push_back(D); } @@ -449,15 +444,10 @@ return; StringRef name = D->getName(); - - if (name.size() == 0) + if (name.empty()) return; - Log *log = GetLog(LLDBLog::Expressions); - - ConstString name_cs(name.str().c_str()); - - LLDB_LOGF(log, "Recording persistent decl %s\n", name_cs.GetCString()); + LLDB_LOG(GetLog(LLDBLog::Expressions), "Recording persistent decl {0}", name); m_decls.push_back(D); } @@ -475,7 +465,6 @@ for (clang::NamedDecl *decl : m_decls) { StringRef name = decl->getName(); - ConstString name_cs(name.str().c_str()); Decl *D_scratch = persistent_vars->GetClangASTImporter()->DeportDecl( &scratch_ts_sp->getASTContext(), decl); @@ -496,8 +485,8 @@ } if (NamedDecl *NamedDecl_scratch = dyn_cast(D_scratch)) - persistent_vars->RegisterPersistentDecl(name_cs, NamedDecl_scratch, - scratch_ts_sp); + persistent_vars->RegisterPersistentDecl(ConstString(name), + NamedDecl_scratch, scratch_ts_sp); } }