[Lldb-commits] [lldb] 2b95b50 - [lldb][ClangExpression] Fix LLDB_LOG incorrect format specifier

Michael Buch via lldb-commits lldb-commits at lists.llvm.org
Fri Aug 26 02:07:10 PDT 2022


Author: Michael Buch
Date: 2022-08-26T10:06:38+01:00
New Revision: 2b95b50dd69b03be793357cbadae70d413b375a5

URL: https://github.com/llvm/llvm-project/commit/2b95b50dd69b03be793357cbadae70d413b375a5
DIFF: https://github.com/llvm/llvm-project/commit/2b95b50dd69b03be793357cbadae70d413b375a5.diff

LOG: [lldb][ClangExpression] Fix LLDB_LOG incorrect format specifier

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.

Differential Revision: https://reviews.llvm.org/D132709

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
index 71242925862b3..3187146b9ba5c 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
@@ -405,7 +405,7 @@ void ClangASTSource::FindExternalLexicalDecls(
     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(),


        


More information about the lldb-commits mailing list