[Lldb-commits] [PATCH] D153905: [lldb][NFCI] Remove unneeded use of ConstString in ASTResultSynthesizer

Alex Langford via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Jun 27 11:40:23 PDT 2023


bulbazord updated this revision to Diff 535084.
bulbazord added a comment.

Remove unneeded newline from log line


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D153905/new/

https://reviews.llvm.org/D153905

Files:
  lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp


Index: lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp
===================================================================
--- lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp
+++ 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<NamedDecl>(D_scratch))
-      persistent_vars->RegisterPersistentDecl(name_cs, NamedDecl_scratch,
-                                              scratch_ts_sp);
+      persistent_vars->RegisterPersistentDecl(ConstString(name),
+                                              NamedDecl_scratch, scratch_ts_sp);
   }
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D153905.535084.patch
Type: text/x-patch
Size: 1828 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230627/4b03f636/attachment.bin>


More information about the lldb-commits mailing list