@@ -170,12 +170,14 @@ std::recursive_mutex g_log_mutex;
170
170
171
171
// / Similar to LLDB_LOG, but with richer contextual information.
172
172
#define LOG_PRINTF (CHANNEL, FMT, ...) \
173
- LOG_PRINTF_IMPL (CHANNEL, false , FMT, ##__VA_ARGS__)
173
+ LOG_PRINTF_IMPL (lldb_private::GetLogIfAllCategoriesSet(CHANNEL), false, FMT, \
174
+ ##__VA_ARGS__)
174
175
#define LOG_VERBOSE_PRINTF (CHANNEL, FMT, ...) \
175
- LOG_PRINTF_IMPL (CHANNEL, true , FMT, ##__VA_ARGS__)
176
+ LOG_PRINTF_IMPL (lldb_private::GetLogIfAllCategoriesSet(CHANNEL), true, FMT, \
177
+ ##__VA_ARGS__)
176
178
#define LOG_PRINTF_IMPL (CHANNEL, VERBOSE, FMT, ...) \
177
179
do { \
178
- if (Log *log = lldb_private::GetLogIfAllCategoriesSet ( CHANNEL)) \
180
+ if (Log *log = CHANNEL) \
179
181
if (!(VERBOSE) || log->GetVerbose ()) { \
180
182
std::lock_guard<std::recursive_mutex> locker (g_log_mutex); \
181
183
/* The format string is optimized for code size, not speed. */ \
@@ -185,19 +187,9 @@ std::recursive_mutex g_log_mutex;
185
187
} \
186
188
} while (0 )
187
189
188
- #define SWIFT_LOG_PRINTF (FMT, ...) \
189
- LOG_PRINTF_IMPL (LIBLLDB_LOG_TYPES, false , FMT, ##__VA_ARGS__); \
190
- SWIFT_LOG_PRINTF_IMPL (FMT, ##__VA_ARGS__)
191
- #define SWIFT_LOG_PRINTF_IMPL (FMT, ...) \
192
- do { \
193
- if (Log *log = lldb_private::GetSwiftHealthLog ()) { \
194
- std::lock_guard<std::recursive_mutex> locker (g_log_mutex); \
195
- /* The format string is optimized for code size, not speed. */ \
196
- log->Printf (" %s::%s%s" FMT, m_description.c_str (), \
197
- IsLambda (__FUNCTION__) ? " " : __FUNCTION__, \
198
- (FMT && FMT[0 ] == ' (' ) ? " " : " () -- " , ##__VA_ARGS__); \
199
- } \
200
- } while (0 )
190
+ #define HEALTH_LOG_PRINTF (FMT, ...) \
191
+ LOG_PRINTF (LIBLLDB_LOG_TYPES, FMT, ##__VA_ARGS__); \
192
+ LOG_PRINTF_IMPL (lldb_private::GetSwiftHealthLog(), false, FMT, ##__VA_ARGS__)
201
193
202
194
using namespace lldb ;
203
195
using namespace lldb_private ;
@@ -5092,61 +5084,62 @@ void SwiftASTContext::ClearModuleDependentCaches() {
5092
5084
void SwiftASTContext::LogConfiguration () {
5093
5085
// It makes no sense to call VALID_OR_RETURN here. We specifically
5094
5086
// want the logs in the error case!
5095
- SWIFT_LOG_PRINTF (" (SwiftASTContext*)%p:" , static_cast <void *>(this ));
5087
+ HEALTH_LOG_PRINTF (" (SwiftASTContext*)%p:" , static_cast <void *>(this ));
5096
5088
5097
5089
if (!m_ast_context_ap) {
5098
- SWIFT_LOG_PRINTF (" (no AST context)" );
5090
+ HEALTH_LOG_PRINTF (" (no AST context)" );
5099
5091
return ;
5100
5092
}
5101
5093
5102
- SWIFT_LOG_PRINTF (" Architecture : %s" ,
5103
- m_ast_context_ap->LangOpts .Target .getTriple ().c_str ());
5104
- SWIFT_LOG_PRINTF (" SDK path : %s" ,
5105
- m_ast_context_ap->SearchPathOpts .SDKPath .c_str ());
5106
- SWIFT_LOG_PRINTF (
5094
+ HEALTH_LOG_PRINTF (" Architecture : %s" ,
5095
+ m_ast_context_ap->LangOpts .Target .getTriple ().c_str ());
5096
+ HEALTH_LOG_PRINTF (" SDK path : %s" ,
5097
+ m_ast_context_ap->SearchPathOpts .SDKPath .c_str ());
5098
+ HEALTH_LOG_PRINTF (
5107
5099
" Runtime resource path : %s" ,
5108
5100
m_ast_context_ap->SearchPathOpts .RuntimeResourcePath .c_str ());
5109
- SWIFT_LOG_PRINTF (" Runtime library paths : (%llu items)" ,
5110
- (unsigned long long )m_ast_context_ap->SearchPathOpts
5111
- .RuntimeLibraryPaths .size ());
5101
+ HEALTH_LOG_PRINTF (" Runtime library paths : (%llu items)" ,
5102
+ (unsigned long long )m_ast_context_ap->SearchPathOpts
5103
+ .RuntimeLibraryPaths .size ());
5112
5104
5113
5105
for (const auto &runtime_library_path :
5114
5106
m_ast_context_ap->SearchPathOpts .RuntimeLibraryPaths ) {
5115
- SWIFT_LOG_PRINTF (" %s" , runtime_library_path.c_str ());
5107
+ HEALTH_LOG_PRINTF (" %s" , runtime_library_path.c_str ());
5116
5108
}
5117
5109
5118
- SWIFT_LOG_PRINTF (" Runtime library import paths : (%llu items)" ,
5119
- (unsigned long long )m_ast_context_ap->SearchPathOpts
5120
- .RuntimeLibraryImportPaths .size ());
5110
+ HEALTH_LOG_PRINTF (" Runtime library import paths : (%llu items)" ,
5111
+ (unsigned long long )m_ast_context_ap->SearchPathOpts
5112
+ .RuntimeLibraryImportPaths .size ());
5121
5113
5122
5114
for (const auto &runtime_import_path :
5123
5115
m_ast_context_ap->SearchPathOpts .RuntimeLibraryImportPaths ) {
5124
- SWIFT_LOG_PRINTF (" %s" , runtime_import_path.c_str ());
5116
+ HEALTH_LOG_PRINTF (" %s" , runtime_import_path.c_str ());
5125
5117
}
5126
5118
5127
- SWIFT_LOG_PRINTF (" Framework search paths : (%llu items)" ,
5128
- (unsigned long long )m_ast_context_ap->SearchPathOpts
5129
- .FrameworkSearchPaths .size ());
5119
+ HEALTH_LOG_PRINTF (" Framework search paths : (%llu items)" ,
5120
+ (unsigned long long )m_ast_context_ap->SearchPathOpts
5121
+ .FrameworkSearchPaths .size ());
5130
5122
for (const auto &framework_search_path :
5131
5123
m_ast_context_ap->SearchPathOpts .FrameworkSearchPaths ) {
5132
- SWIFT_LOG_PRINTF (" %s" , framework_search_path.Path .c_str ());
5124
+ HEALTH_LOG_PRINTF (" %s" , framework_search_path.Path .c_str ());
5133
5125
}
5134
5126
5135
- SWIFT_LOG_PRINTF (" Import search paths : (%llu items)" ,
5136
- (unsigned long long )m_ast_context_ap->SearchPathOpts
5137
- .ImportSearchPaths .size ());
5127
+ HEALTH_LOG_PRINTF (" Import search paths : (%llu items)" ,
5128
+ (unsigned long long )m_ast_context_ap->SearchPathOpts
5129
+ .ImportSearchPaths .size ());
5138
5130
for (std::string &import_search_path :
5139
5131
m_ast_context_ap->SearchPathOpts .ImportSearchPaths ) {
5140
- SWIFT_LOG_PRINTF (" %s" , import_search_path.c_str ());
5132
+ HEALTH_LOG_PRINTF (" %s" , import_search_path.c_str ());
5141
5133
}
5142
5134
5143
5135
swift::ClangImporterOptions &clang_importer_options =
5144
5136
GetClangImporterOptions ();
5145
5137
5146
- SWIFT_LOG_PRINTF (" Extra clang arguments : (%llu items)" ,
5147
- (unsigned long long )clang_importer_options.ExtraArgs .size ());
5138
+ HEALTH_LOG_PRINTF (
5139
+ " Extra clang arguments : (%llu items)" ,
5140
+ (unsigned long long )clang_importer_options.ExtraArgs .size ());
5148
5141
for (std::string &extra_arg : clang_importer_options.ExtraArgs ) {
5149
- SWIFT_LOG_PRINTF (" %s" , extra_arg.c_str ());
5142
+ HEALTH_LOG_PRINTF (" %s" , extra_arg.c_str ());
5150
5143
}
5151
5144
}
5152
5145
0 commit comments