Skip to content

Commit 990e905

Browse files
committed
addressing feedback
1 parent 58229d7 commit 990e905

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

flang/lib/Parser/message.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -273,16 +273,16 @@ static llvm::raw_ostream::Colors PrefixColor(Severity severity) {
273273
}
274274

275275
// 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};
278278

279279
void Message::Emit(llvm::raw_ostream &o, const AllCookedSources &allCooked,
280280
bool echoSourceLine) const {
281281
std::optional<ProvenanceRange> provenanceRange{GetProvenanceRange(allCooked)};
282282
const AllSources &sources{allCooked.allSources()};
283283
sources.EmitMessage(o, provenanceRange, ToString(), Prefix(severity()),
284284
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.
286286
bool isContext{attachmentIsContext_};
287287
int contextsEmitted{0};
288288
// Emit attachments.
@@ -300,9 +300,9 @@ void Message::Emit(llvm::raw_ostream &o, const AllCookedSources &allCooked,
300300
// Truncate the number of contexts emitted.
301301
if (contextsEmitted < MAX_CONTEXTS_EMITTED) {
302302
emitAttachment();
303-
contextsEmitted += 1;
303+
++contextsEmitted;
304304
}
305-
if (OMIT_SHARED_CONTEXTS) {
305+
if constexpr (OMIT_SHARED_CONTEXTS) {
306306
// Skip less specific contexts at the same location.
307307
for (const Message *next_attachment{attachment->attachment_.get()};
308308
next_attachment && next_attachment->attachmentIsContext_ &&

flang/lib/Parser/openacc-parsers.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ namespace Fortran::parser {
2323
// other types of line comments from fixed form.
2424
constexpr auto startAccLine{skipStuffBeforeStatement >>
2525
withMessage(
26-
"expected OpenACC directive sentinal: !$ACC (free-form) / C$ACC or *$ACC (fixed-form)"_err_en_US,
26+
"expected OpenACC directive sentinel: !$ACC (free-form) / C$ACC or *$ACC (fixed-form)"_err_en_US,
2727
"!$ACC "_sptok)};
2828
constexpr auto endAccLine{space >>
2929
recovery(
@@ -238,9 +238,8 @@ TYPE_PARSER(construct<OpenACCBlockConstruct>(
238238
recovery(withMessage("expected OpenACC end block directive"_err_en_US,
239239
attempt(Parser<AccEndBlockDirective>{} / endAccLine)),
240240
// TODO: Is there a simpler way to build this?
241-
sourced(construct<AccEndBlockDirective>(
242-
sourced(construct<AccBlockDirective>(
243-
pure(llvm::acc::Directive::ACCD_data))))))))
241+
construct<AccEndBlockDirective>(construct<AccBlockDirective>(
242+
pure(llvm::acc::Directive::ACCD_data))))))
244243

245244
// Standalone constructs
246245
TYPE_PARSER(construct<OpenACCStandaloneConstruct>(

0 commit comments

Comments
 (0)