Otherwise subsequent .option arch, +foo directives (but not -, since
those have their own separate validation) fail the parseFeatureBits
check, leading to cascading errors.
Reviewed By: luismarques, MaskRay
Differential Revision: https://reviews.llvm.org/
D152273
Args.emplace_back(Type, Ext->Key);
if (Type == RISCVOptionArchArgType::Plus) {
+ FeatureBitset OldFeatureBits = STI->getFeatureBits();
+
setFeatureBits(Ext->Value, Ext->Key);
auto ParseResult = RISCVFeatures::parseFeatureBits(isRV64(), STI->getFeatureBits());
if (!ParseResult) {
+ copySTI().setFeatureBits(OldFeatureBits);
+ setAvailableFeatures(ComputeAvailableFeatures(OldFeatureBits));
+
std::string Buffer;
raw_string_ostream OutputErrMsg(Buffer);
handleAllErrors(ParseResult.takeError(), [&](llvm::StringError &ErrMsg) {
# RUN: not llvm-mc -triple riscv32 < %s 2>&1 \
-# RUN: | FileCheck -check-prefixes=CHECK %s
+# RUN: | FileCheck --implicit-check-not=error: %s
# CHECK: :[[#@LINE+1]]:8: error: expected identifier
.option
# CHECK: :[[#@LINE+1]]:20: error: 'f' and 'zfinx' extensions are incompatible
.option arch, +f, +zfinx
+## Make sure the above error isn't sticky
+.option arch, +f
+
# CHECK: :[[#@LINE+1]]:13: error: expected newline
.option rvc foo