diff --git a/clang/lib/Driver/ToolChains/Arch/RISCV.cpp b/clang/lib/Driver/ToolChains/Arch/RISCV.cpp --- a/clang/lib/Driver/ToolChains/Arch/RISCV.cpp +++ b/clang/lib/Driver/ToolChains/Arch/RISCV.cpp @@ -41,7 +41,8 @@ return false; } - (*ISAInfo)->toFeatures(Args, Features); + (*ISAInfo)->toFeatures( + Features, [&Args](const Twine &Str) { return Args.MakeArgString(Str); }); return true; } diff --git a/llvm/include/llvm/Support/RISCVISAInfo.h b/llvm/include/llvm/Support/RISCVISAInfo.h --- a/llvm/include/llvm/Support/RISCVISAInfo.h +++ b/llvm/include/llvm/Support/RISCVISAInfo.h @@ -19,9 +19,6 @@ #include namespace llvm { -namespace opt { -class ArgList; -} struct RISCVExtensionInfo { std::string ExtName; unsigned MajorVersion; @@ -57,8 +54,8 @@ parseFeatures(unsigned XLen, const std::vector &Features); /// Convert RISCV ISA info to a feature vector. - void toFeatures(const llvm::opt::ArgList &Args, - std::vector &Features) const; + void toFeatures(std::vector &Features, + std::function StrAlloc) const; const OrderedExtensionMap &getExtensions() const { return Exts; }; diff --git a/llvm/lib/Support/RISCVISAInfo.cpp b/llvm/lib/Support/RISCVISAInfo.cpp --- a/llvm/lib/Support/RISCVISAInfo.cpp +++ b/llvm/lib/Support/RISCVISAInfo.cpp @@ -11,7 +11,6 @@ #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/StringExtras.h" #include "llvm/ADT/StringRef.h" -#include "llvm/Option/ArgList.h" #include "llvm/Support/Errc.h" #include "llvm/Support/Error.h" #include "llvm/Support/raw_ostream.h" @@ -252,8 +251,9 @@ return LHS < RHS; } -void RISCVISAInfo::toFeatures(const llvm::opt::ArgList &Args, - std::vector &Features) const { +void RISCVISAInfo::toFeatures( + std::vector &Features, + std::function StrAlloc) const { for (auto &Ext : Exts) { StringRef ExtName = Ext.first; @@ -268,9 +268,9 @@ Features.push_back("+experimental-zvlsseg"); Features.push_back("+experimental-zvamo"); } else if (isExperimentalExtension(ExtName)) { - Features.push_back(Args.MakeArgString("+experimental-" + ExtName)); + Features.push_back(StrAlloc("+experimental-" + ExtName)); } else { - Features.push_back(Args.MakeArgString("+" + ExtName)); + Features.push_back(StrAlloc("+" + ExtName)); } } }