@@ -273,16 +273,16 @@ static llvm::raw_ostream::Colors PrefixColor(Severity severity) {
273
273
}
274
274
275
275
// TODO: Make these configurable, based on verbosity level.
276
- const int MAX_CONTEXTS_EMITTED = 2 ;
277
- const bool OMIT_SHARED_CONTEXTS = true ;
276
+ static constexpr int MAX_CONTEXTS_EMITTED{ 2 } ;
277
+ static constexpr bool OMIT_SHARED_CONTEXTS{ true } ;
278
278
279
279
void Message::Emit (llvm::raw_ostream &o, const AllCookedSources &allCooked,
280
280
bool echoSourceLine) const {
281
281
std::optional<ProvenanceRange> provenanceRange{GetProvenanceRange (allCooked)};
282
282
const AllSources &sources{allCooked.allSources ()};
283
283
sources.EmitMessage (o, provenanceRange, ToString (), Prefix (severity ()),
284
284
PrefixColor (severity ()), echoSourceLine);
285
- // Always refers to if the attachment in the loop below is a context.
285
+ // Always refers to whether the attachment in the loop below is a context.
286
286
bool isContext{attachmentIsContext_};
287
287
int contextsEmitted{0 };
288
288
// Emit attachments.
@@ -300,9 +300,9 @@ void Message::Emit(llvm::raw_ostream &o, const AllCookedSources &allCooked,
300
300
// Truncate the number of contexts emitted.
301
301
if (contextsEmitted < MAX_CONTEXTS_EMITTED) {
302
302
emitAttachment ();
303
- contextsEmitted += 1 ;
303
+ ++contextsEmitted ;
304
304
}
305
- if (OMIT_SHARED_CONTEXTS) {
305
+ if constexpr (OMIT_SHARED_CONTEXTS) {
306
306
// Skip less specific contexts at the same location.
307
307
for (const Message *next_attachment{attachment->attachment_ .get ()};
308
308
next_attachment && next_attachment->attachmentIsContext_ &&
0 commit comments