This revision was automatically updated to reflect the committed changes. Closed by commit rL367132: Document that LLDB_LOG macros use the format_providers. (authored by jingham, committed by ). Herald added a project: LLVM. Herald added a subscriber: llvm-commits.
Changed prior to commit: https://reviews.llvm.org/D65293?vs=211791&id=211964#toc Repository: rL LLVM CHANGES SINCE LAST ACTION https://reviews.llvm.org/D65293/new/ https://reviews.llvm.org/D65293 Files: lldb/trunk/include/lldb/Utility/Log.h Index: lldb/trunk/include/lldb/Utility/Log.h =================================================================== --- lldb/trunk/include/lldb/Utility/Log.h +++ lldb/trunk/include/lldb/Utility/Log.h @@ -206,6 +206,26 @@ } // namespace lldb_private +/// The LLDB_LOG* macros defined below are the way to emit log messages. +/// +/// Note that the macros surround the arguments in a check for the log +/// being on, so you can freely call methods in arguments without affecting +/// the non-log execution flow. +/// +/// If you need to do more complex computations to prepare the log message +/// be sure to add your own if (log) check, since we don't want logging to +/// have any effect when not on. +/// +/// However, the LLDB_LOG macro uses the llvm::formatv system (see the +/// ProgrammersManual page in the llvm docs for more details). This allows +/// the use of "format_providers" to auto-format datatypes, and there are +/// already formatters for some of the llvm and lldb datatypes. +/// +/// So if you need to do non-trivial formatting of one of these types, be +/// sure to grep the lldb and llvm sources for "format_provider" to see if +/// there is already a formatter before doing in situ formatting, and if +/// possible add a provider if one does not already exist. + #define LLDB_LOG(log, ...) \ do { \ ::lldb_private::Log *log_private = (log); \
Index: lldb/trunk/include/lldb/Utility/Log.h =================================================================== --- lldb/trunk/include/lldb/Utility/Log.h +++ lldb/trunk/include/lldb/Utility/Log.h @@ -206,6 +206,26 @@ } // namespace lldb_private +/// The LLDB_LOG* macros defined below are the way to emit log messages. +/// +/// Note that the macros surround the arguments in a check for the log +/// being on, so you can freely call methods in arguments without affecting +/// the non-log execution flow. +/// +/// If you need to do more complex computations to prepare the log message +/// be sure to add your own if (log) check, since we don't want logging to +/// have any effect when not on. +/// +/// However, the LLDB_LOG macro uses the llvm::formatv system (see the +/// ProgrammersManual page in the llvm docs for more details). This allows +/// the use of "format_providers" to auto-format datatypes, and there are +/// already formatters for some of the llvm and lldb datatypes. +/// +/// So if you need to do non-trivial formatting of one of these types, be +/// sure to grep the lldb and llvm sources for "format_provider" to see if +/// there is already a formatter before doing in situ formatting, and if +/// possible add a provider if one does not already exist. + #define LLDB_LOG(log, ...) \ do { \ ::lldb_private::Log *log_private = (log); \
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits