Introduce parenthesis in BuildAsciiCharFlags

This CL fixes an upcoming clang compiler warning (-Wparentheses).

BuildAsciiCharFlags uses ternary operator '?' together with bitwise
or '|'. Bitwise or '|' binds stronger than '?', so BuildAsciiCharsFlags
is basically: return check1(c) ? E1
                  : (0 | check2(c)) ? E2
                       : (0 | check3(c)) ? E3
                           : 0;
This CL fixes this.

Change-Id: I794ef4aa19786e61b23d1f2b35eff486cf6d569a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1738850
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Auto-Submit: Simon Zünd <szuend@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
Cr-Commit-Position: refs/heads/master@{#63091}
This commit is contained in:
Simon Zünd 2019-08-06 13:00:04 +02:00 committed by Commit Bot
parent bea2651b56
commit db9e542662

View File

@ -83,11 +83,11 @@ enum AsciiCharFlags {
constexpr uint8_t BuildAsciiCharFlags(uc32 c) {
// clang-format off
return
(IsAsciiIdentifier(c) || c == '\\') ? (
kIsIdentifierPart | (!IsDecimalDigit(c) ? kIsIdentifierStart : 0)) : 0 |
(c == ' ' || c == '\t' || c == '\v' || c == '\f') ?
kIsWhiteSpace | kIsWhiteSpaceOrLineTerminator : 0 |
(c == '\r' || c == '\n') ? kIsWhiteSpaceOrLineTerminator : 0;
((IsAsciiIdentifier(c) || c == '\\') ? (
kIsIdentifierPart | (!IsDecimalDigit(c) ? kIsIdentifierStart : 0)) : 0) |
((c == ' ' || c == '\t' || c == '\v' || c == '\f') ?
kIsWhiteSpace | kIsWhiteSpaceOrLineTerminator : 0) |
((c == '\r' || c == '\n') ? kIsWhiteSpaceOrLineTerminator : 0);
// clang-format on
}
const constexpr uint8_t kAsciiCharFlags[128] = {