Skip to content

Commit ac211cc

Browse files
committed
Use a better log channel.
The original code used target && expr which is probably more an accident than the intended behavior. This patch uses the verbose expr channel instead.
1 parent 0744844 commit ac211cc

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

lldb/source/Plugins/TypeSystem/Swift/SwiftASTContext.cpp

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -170,14 +170,19 @@ std::recursive_mutex g_log_mutex;
170170

171171
/// Similar to LLDB_LOG, but with richer contextual information.
172172
#define LOG_PRINTF(CHANNEL, FMT, ...) \
173+
LOG_PRINTF_IMPL(CHANNEL, false, FMT, ##__VA_ARGS__)
174+
#define LOG_VERBOSE_PRINTF(CHANNEL, FMT, ...) \
175+
LOG_PRINTF_IMPL(CHANNEL, true, FMT, ##__VA_ARGS__)
176+
#define LOG_PRINTF_IMPL(CHANNEL, VERBOSE, FMT, ...) \
173177
do { \
174-
if (Log *log = lldb_private::GetLogIfAllCategoriesSet(CHANNEL)) { \
175-
std::lock_guard<std::recursive_mutex> locker(g_log_mutex); \
176-
/* The format string is optimized for code size, not speed. */ \
177-
log->Printf("%s::%s%s" FMT, m_description.c_str(), \
178-
IsLambda(__FUNCTION__) ? "" : __FUNCTION__, \
179-
(FMT && FMT[0] == '(') ? "" : "() -- ", ##__VA_ARGS__); \
180-
} \
178+
if (Log *log = lldb_private::GetLogIfAllCategoriesSet(CHANNEL)) \
179+
if (!(VERBOSE) || log->GetVerbose()) { \
180+
std::lock_guard<std::recursive_mutex> locker(g_log_mutex); \
181+
/* The format string is optimized for code size, not speed. */ \
182+
log->Printf("%s::%s%s" FMT, m_description.c_str(), \
183+
IsLambda(__FUNCTION__) ? "" : __FUNCTION__, \
184+
(FMT && FMT[0] == '(') ? "" : "() -- ", ##__VA_ARGS__); \
185+
} \
181186
} while (0)
182187

183188
using namespace lldb;
@@ -2067,10 +2072,9 @@ ProcessModule(ModuleSP &&module_sp, std::string m_description,
20672072
framework_search_paths.push_back({fwsp.Path, fwsp.IsSystem});
20682073
for (const std::string &arg : ast_context->GetClangArguments()) {
20692074
extra_clang_args.push_back(arg);
2070-
if (lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_TARGET))
2071-
LOG_PRINTF(LIBLLDB_LOG_TYPES,
2072-
"ProcessModule(\"%s\") adding Clang argument \"%s\".",
2073-
module_file.GetFilename().AsCString(""), arg.c_str());
2075+
LOG_VERBOSE_PRINTF(LIBLLDB_LOG_TYPES,
2076+
"ProcessModule(\"%s\") adding Clang argument \"%s\".",
2077+
module_file.GetFilename().AsCString(""), arg.c_str());
20742078
}
20752079
}
20762080
}

0 commit comments

Comments
 (0)