[clang] [RISCV][NFC] Use RISCVISAInfo instead of string comparison (PR #76387)
Craig Topper via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 26 20:46:05 PST 2023
================
@@ -670,10 +671,18 @@ static llvm::Triple computeTargetTriple(const Driver &D,
if (Args.hasArg(options::OPT_march_EQ) ||
Args.hasArg(options::OPT_mcpu_EQ)) {
StringRef ArchName = tools::riscv::getRISCVArch(Args, Target);
- if (ArchName.starts_with_insensitive("rv32"))
- Target.setArch(llvm::Triple::riscv32);
- else if (ArchName.starts_with_insensitive("rv64"))
- Target.setArch(llvm::Triple::riscv64);
+ auto ISAInfo = llvm::RISCVISAInfo::parseArchString(
+ ArchName, /*EnableExperimentalExtensions=*/true);
+ if (!ISAInfo) {
----------------
topperc wrote:
Use `errorToBool` to avoid the call to consumeError?
https://github.com/llvm/llvm-project/pull/76387
More information about the cfe-commits
mailing list