[flang] Answer first comments

Original-commit: flang-compiler/f18@4058efcd9c
Reviewed-on: https://github.com/flang-compiler/f18/pull/471
Tree-same-pre-rewrite: false
This commit is contained in:
Jean Perier 2019-06-04 02:11:58 -07:00
parent e303c352ce
commit 6a1b208a4d
2 changed files with 4 additions and 4 deletions

View file

@ -44,7 +44,7 @@ public:
} else if constexpr (KIND == 4) {
return IsValidUCS4(code);
} else {
static_assert(true, "bad character kind");
static_assert(KIND != KIND, "bad character kind");
}
}
@ -87,8 +87,8 @@ private:
std::uint16_t lo{static_cast<std::uint16_t>(code & 0xff)};
return IsValidASCII(code) ||
(code < 0xffff &&
((0xa1 <= hi && hi <= 0Xfe && 0xa1 <= lo && lo <= 0Xfe) ||
(hi == 0X8e && 0xa1 <= lo && lo <= 0Xdf)));
((0xa1 <= hi && hi <= 0xfe && 0xa1 <= lo && lo <= 0xfe) ||
(hi == 0x8e && 0xa1 <= lo && lo <= 0xdf)));
}
static constexpr bool IsValidUCS4(std::uint64_t code) {
return code < 0xd800 || (0xdc00 < code && code <= 0x10ffff);

View file

@ -545,7 +545,7 @@ void Prescanner::QuotedCharacterLiteral(
bool escape{false};
bool escapesEnabled{features_.IsEnabled(LanguageFeature::BackslashEscapes)};
while (true) {
unsigned char ch{static_cast<unsigned char>(*at_)};
char32_t ch{static_cast<unsigned char>(*at_)};
escape = !escape && ch == '\\' && escapesEnabled;
EmitQuotedChar(ch, emit, insert, false, !escapesEnabled);
while (PadOutCharacterLiteral(tokens)) {