diff options
Diffstat (limited to 'contrib/llvm-project/llvm/lib/CodeGen/CommandFlags.cpp')
-rw-r--r-- | contrib/llvm-project/llvm/lib/CodeGen/CommandFlags.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/contrib/llvm-project/llvm/lib/CodeGen/CommandFlags.cpp b/contrib/llvm-project/llvm/lib/CodeGen/CommandFlags.cpp index fd52191882cb..48cd8e998ec9 100644 --- a/contrib/llvm-project/llvm/lib/CodeGen/CommandFlags.cpp +++ b/contrib/llvm-project/llvm/lib/CodeGen/CommandFlags.cpp @@ -23,6 +23,7 @@ #include "llvm/Support/CommandLine.h" #include "llvm/Support/Host.h" #include "llvm/Support/MemoryBuffer.h" +#include <optional> using namespace llvm; @@ -40,14 +41,15 @@ using namespace llvm; return *NAME##View; \ } +// Temporary macro for incremental transition to std::optional. #define CGOPT_EXP(TY, NAME) \ CGOPT(TY, NAME) \ - Optional<TY> codegen::getExplicit##NAME() { \ + std::optional<TY> codegen::getExplicit##NAME() { \ if (NAME##View->getNumOccurrences()) { \ TY res = *NAME##View; \ return res; \ } \ - return None; \ + return std::nullopt; \ } CGOPT(std::string, MArch) @@ -357,7 +359,7 @@ codegen::RegisterCodeGenFlags::RegisterCodeGenFlags() { "relax-elf-relocations", cl::desc( "Emit GOTPCRELX/REX_GOTPCRELX instead of GOTPCREL on x86-64 ELF"), - cl::init(false)); + cl::init(true)); CGBINDOPT(RelaxELFRelocations); static cl::opt<bool> DataSections( @@ -590,8 +592,8 @@ std::string codegen::getFeaturesStr() { if (getMCPU() == "native") { StringMap<bool> HostFeatures; if (sys::getHostCPUFeatures(HostFeatures)) - for (auto &F : HostFeatures) - Features.AddFeature(F.first(), F.second); + for (const auto &[Feature, IsEnabled] : HostFeatures) + Features.AddFeature(Feature, IsEnabled); } for (auto const &MAttr : getMAttrs()) @@ -610,8 +612,8 @@ std::vector<std::string> codegen::getFeatureList() { if (getMCPU() == "native") { StringMap<bool> HostFeatures; if (sys::getHostCPUFeatures(HostFeatures)) - for (auto &F : HostFeatures) - Features.AddFeature(F.first(), F.second); + for (const auto &[Feature, IsEnabled] : HostFeatures) + Features.AddFeature(Feature, IsEnabled); } for (auto const &MAttr : getMAttrs()) |