// ">foo" is parsed to ">" and "foo", but ">>" is parsed to ">>".
if (S.startswith("<<") || S.startswith("<=") || S.startswith(">>") ||
- S.startswith(">=")) {
+ S.startswith(">=") || S.startswith("||") || S.startswith("&&")) {
Vec.push_back(S.substr(0, 2));
S = S.substr(2);
continue;
static int precedence(StringRef Op) {
return StringSwitch<int>(Op)
- .Cases("*", "/", "%", 6)
- .Cases("+", "-", 5)
- .Cases("<<", ">>", 4)
- .Cases("<", "<=", ">", ">=", "==", "!=", 3)
- .Case("&", 2)
- .Case("|", 1)
+ .Cases("*", "/", "%", 8)
+ .Cases("+", "-", 7)
+ .Cases("<<", ">>", 6)
+ .Cases("<", "<=", ">", ">=", "==", "!=", 5)
+ .Case("&", 4)
+ .Case("|", 3)
+ .Case("&&", 2)
+ .Case("||", 1)
.Default(-1);
}
return [=] { return L().getValue() == R().getValue(); };
if (Op == "!=")
return [=] { return L().getValue() != R().getValue(); };
+ if (Op == "||")
+ return [=] { return L().getValue() || R().getValue(); };
+ if (Op == "&&")
+ return [=] { return L().getValue() && R().getValue(); };
if (Op == "&")
return [=] { return bitAnd(L(), R()); };
if (Op == "|")
minus_abs = _end - _start;
max = MAX(11, 22);
min = MIN(11, 22);
+ logicaland1 = 0 && 0;
+ logicaland2 = 0 && 1;
+ logicaland3 = 1 && 0;
+ logicaland4 = 1 && 1;
+ logicalor1 = 0 || 0;
+ logicalor2 = 0 || 1;
+ logicalor3 = 1 || 0;
+ logicalor4 = 1 || 1;
}
# CHECK: 00000000000006 *ABS* 00000000 plus
# CHECK: 0000000000fff0 *ABS* 00000000 minus_abs
# CHECK: 00000000000016 *ABS* 00000000 max
# CHECK: 0000000000000b *ABS* 00000000 min
+# CHECK: 00000000000000 *ABS* 00000000 logicaland1
+# CHECK: 00000000000000 *ABS* 00000000 logicaland2
+# CHECK: 00000000000000 *ABS* 00000000 logicaland3
+# CHECK: 00000000000001 *ABS* 00000000 logicaland4
+# CHECK: 00000000000000 *ABS* 00000000 logicalor1
+# CHECK: 00000000000001 *ABS* 00000000 logicalor2
+# CHECK: 00000000000001 *ABS* 00000000 logicalor3
+# CHECK: 00000000000001 *ABS* 00000000 logicalor4
## Mailformed number error.
# RUN: echo "SECTIONS { . = 0x12Q41; }" > %t.script