[flang-commits] [flang] [flang] Place MIN/MAX A1/A2 first in semantic analysis (PR #69722)
via flang-commits
flang-commits at lists.llvm.org
Mon Oct 23 01:41:23 PDT 2023
================
@@ -1446,63 +1446,76 @@ static std::int64_t GetBuiltinKind(
// Ensure that the keywords of arguments to MAX/MIN and their variants
// are of the form A123 with no duplicates or leading zeroes.
-static bool CheckMaxMinArgument(std::optional<parser::CharBlock> keyword,
+static bool CheckMaxMinArgument(parser::CharBlock keyword,
std::set<parser::CharBlock> &set, const char *intrinsicName,
parser::ContextualMessages &messages) {
- if (keyword) {
- std::size_t j{1};
- for (; j < keyword->size(); ++j) {
- char ch{(*keyword)[j]};
- if (ch < (j == 1 ? '1' : '0') || ch > '9') {
- break;
- }
+ std::size_t j{1};
+ for (; j < keyword.size(); ++j) {
+ char ch{(keyword)[j]};
+ if (ch < (j == 1 ? '1' : '0') || ch > '9') {
+ break;
}
- if (keyword->size() < 2 || (*keyword)[0] != 'a' || j < keyword->size()) {
- messages.Say(*keyword,
- "Argument keyword '%s=' is not known in call to '%s'"_err_en_US,
- *keyword, intrinsicName);
+ }
+ if (keyword.size() < 2 || (keyword)[0] != 'a' || j < keyword.size()) {
+ messages.Say(keyword,
+ "argument keyword '%s=' is not known in call to '%s'"_err_en_US,
+ keyword, intrinsicName);
+ return false;
+ }
+ auto [_, wasInserted]{set.insert(keyword)};
----------------
jeanPerier wrote:
Thanks for the review, updated.
https://github.com/llvm/llvm-project/pull/69722
More information about the flang-commits
mailing list