[Lldb-commits] [PATCH] D132709: [lldb][ClangExpression] Fix LLDB_LOG incorrect format specifier

Michael Buch via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Aug 25 15:43:53 PDT 2022


Michael137 created this revision.
Michael137 added a reviewer: aprantl.
Herald added a project: All.
Michael137 requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Previously this would log:

   FindExternalLexicalDecls on (ASTContext*)0x00000005CE825200 'Expression
  ASTContext for '<user expression 0>'' in 'weak_ptr'
  (%sDecl*)ClassTemplateSpecialization
   FindExternalLexicalDecls on (ASTContext*)0x00000005CE825200 'Expression
  ASTContext for '<user expression 0>'' in '__shared_count'
  (%sDecl*)CXXRecord

Note that the `%s` isn't actually respected. This patch fixes this
by providing the format specifiers that `lldb::formatv` supports.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D132709

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


Index: lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
===================================================================
--- lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
@@ -405,7 +405,7 @@
     if (const NamedDecl *context_named_decl = dyn_cast<NamedDecl>(context_decl))
       LLDB_LOG(log,
                "FindExternalLexicalDecls on (ASTContext*){0} '{1}' in "
-               "'{2}' (%sDecl*){3}",
+               "'{2}' ({3}Decl*){4}",
                m_ast_context, m_clang_ast_context->getDisplayName(),
                context_named_decl->getNameAsString().c_str(),
                context_decl->getDeclKindName(),


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D132709.455742.patch
Type: text/x-patch
Size: 724 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220825/795964b1/attachment.bin>


More information about the lldb-commits mailing list