@@ -60,13 +60,14 @@ void Log::ListCategories(llvm::raw_ostream &stream,
60
60
});
61
61
}
62
62
63
- uint32_t Log::GetFlags (llvm::raw_ostream &stream, const ChannelMap::value_type &entry,
64
- llvm::ArrayRef<const char *> categories) {
63
+ Log::MaskType Log::GetFlags (llvm::raw_ostream &stream,
64
+ const ChannelMap::value_type &entry,
65
+ llvm::ArrayRef<const char *> categories) {
65
66
bool list_categories = false ;
66
- uint32_t flags = 0 ;
67
+ Log::MaskType flags = 0 ;
67
68
for (const char *category : categories) {
68
69
if (llvm::StringRef (" all" ).equals_insensitive (category)) {
69
- flags |= UINT32_MAX ;
70
+ flags |= std::numeric_limits<Log::MaskType>:: max () ;
70
71
continue ;
71
72
}
72
73
if (llvm::StringRef (" default" ).equals_insensitive (category)) {
@@ -91,7 +92,7 @@ uint32_t Log::GetFlags(llvm::raw_ostream &stream, const ChannelMap::value_type &
91
92
}
92
93
93
94
void Log::Enable (const std::shared_ptr<LogHandler> &handler_sp,
94
- uint32_t options, uint32_t flags) {
95
+ uint32_t options, Log::MaskType flags) {
95
96
llvm::sys::ScopedWriter lock (m_mutex);
96
97
97
98
MaskType mask = m_mask.fetch_or (flags, std::memory_order_relaxed);
@@ -102,7 +103,7 @@ void Log::Enable(const std::shared_ptr<LogHandler> &handler_sp,
102
103
}
103
104
}
104
105
105
- void Log::Disable (uint32_t flags) {
106
+ void Log::Disable (Log::MaskType flags) {
106
107
llvm::sys::ScopedWriter lock (m_mutex);
107
108
108
109
MaskType mask = m_mask.fetch_and (~flags, std::memory_order_relaxed);
@@ -126,7 +127,7 @@ const Flags Log::GetOptions() const {
126
127
return m_options.load (std::memory_order_relaxed);
127
128
}
128
129
129
- const Flags Log::GetMask () const {
130
+ Log::MaskType Log::GetMask () const {
130
131
return m_mask.load (std::memory_order_relaxed);
131
132
}
132
133
@@ -203,7 +204,7 @@ void Log::Register(llvm::StringRef name, Channel &channel) {
203
204
void Log::Unregister (llvm::StringRef name) {
204
205
auto iter = g_channel_map->find (name);
205
206
assert (iter != g_channel_map->end ());
206
- iter->second .Disable (UINT32_MAX );
207
+ iter->second .Disable (std::numeric_limits<MaskType>:: max () );
207
208
g_channel_map->erase (iter);
208
209
}
209
210
@@ -216,7 +217,7 @@ bool Log::EnableLogChannel(const std::shared_ptr<LogHandler> &log_handler_sp,
216
217
error_stream << llvm::formatv (" Invalid log channel '{0}'.\n " , channel);
217
218
return false ;
218
219
}
219
- uint32_t flags = categories.empty ()
220
+ MaskType flags = categories.empty ()
220
221
? iter->second .m_channel .default_flags
221
222
: GetFlags (error_stream, *iter, categories);
222
223
iter->second .Enable (log_handler_sp, log_options, flags);
@@ -231,8 +232,8 @@ bool Log::DisableLogChannel(llvm::StringRef channel,
231
232
error_stream << llvm::formatv (" Invalid log channel '{0}'.\n " , channel);
232
233
return false ;
233
234
}
234
- uint32_t flags = categories.empty ()
235
- ? UINT32_MAX
235
+ MaskType flags = categories.empty ()
236
+ ? std::numeric_limits<MaskType>:: max ()
236
237
: GetFlags (error_stream, *iter, categories);
237
238
iter->second .Disable (flags);
238
239
return true ;
@@ -267,7 +268,7 @@ bool Log::ListChannelCategories(llvm::StringRef channel,
267
268
268
269
void Log::DisableAllLogChannels () {
269
270
for (auto &entry : *g_channel_map)
270
- entry.second .Disable (UINT32_MAX );
271
+ entry.second .Disable (std::numeric_limits<MaskType>:: max () );
271
272
}
272
273
273
274
void Log::ForEachChannelCategory (
0 commit comments