Skip to content

Commit 727a977

Browse files
committed
addressing TODOs in comments
1 parent b805e5e commit 727a977

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

flang/lib/Parser/message.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <cstdio>
1717
#include <cstring>
1818
#include <string>
19+
#include <tuple>
1920
#include <vector>
2021

2122
namespace Fortran::parser {
@@ -272,7 +273,6 @@ static llvm::raw_ostream::Colors PrefixColor(Severity severity) {
272273
return llvm::raw_ostream::SAVEDCOLOR;
273274
}
274275

275-
// TODO: Make these configurable, based on verbosity level.
276276
static constexpr int MAX_CONTEXTS_EMITTED{2};
277277
static constexpr bool OMIT_SHARED_CONTEXTS{true};
278278

@@ -282,7 +282,9 @@ void Message::Emit(llvm::raw_ostream &o, const AllCookedSources &allCooked,
282282
const AllSources &sources{allCooked.allSources()};
283283
sources.EmitMessage(o, provenanceRange, ToString(), Prefix(severity()),
284284
PrefixColor(severity()), echoSourceLine);
285-
// Always refers to whether the attachment in the loop below is a context.
285+
// Refers to whether the attachment in the loop below is a context, but can't
286+
// be declared inside the loop because the previous iteration's
287+
// attachment->attachmentIsContext_ indicates this.
286288
bool isContext{attachmentIsContext_};
287289
int contextsEmitted{0};
288290
// Emit attachments.

flang/lib/Parser/openacc-parsers.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -228,18 +228,18 @@ TYPE_PARSER(sourced(construct<AccBeginBlockDirective>(
228228
sourced(Parser<AccBlockDirective>{}), Parser<AccClauseList>{})))
229229

230230
TYPE_PARSER(startAccLine >> sourced(construct<AccEndBlockDirective>("END"_tok >>
231-
sourced(recovery(Parser<AccBlockDirective>{},
231+
recovery(sourced(Parser<AccBlockDirective>{}),
232232
construct<AccBlockDirective>(pure(
233-
llvm::acc::Directive::ACCD_data)))))))
233+
llvm::acc::Directive::ACCD_data))))))
234234

235235
TYPE_PARSER(construct<OpenACCBlockConstruct>(
236236
Parser<AccBeginBlockDirective>{} / endAccLine, block,
237-
// TODO: This still allows mismatched directives.
237+
// NB, This allows mismatched directives, but semantics checks that they match.
238238
recovery(withMessage("expected OpenACC end block directive"_err_en_US,
239239
attempt(Parser<AccEndBlockDirective>{} / endAccLine)),
240-
// TODO: Is there a simpler way to build this?
241-
construct<AccEndBlockDirective>(construct<AccBlockDirective>(
242-
pure(llvm::acc::Directive::ACCD_data))))))
240+
construct<AccEndBlockDirective>(
241+
construct<AccBlockDirective>(pure(
242+
llvm::acc::Directive::ACCD_data))))))
243243

244244
// Standalone constructs
245245
TYPE_PARSER(construct<OpenACCStandaloneConstruct>(

0 commit comments

Comments
 (0)