From e3b557809604d036af6e00c60f012c2025b59a5e Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sat, 11 Feb 2023 13:38:04 +0100 Subject: Vendor import of llvm-project main llvmorg-16-init-18548-gb0daacf58f41, the last commit before the upstream release/17.x branch was created. --- llvm/lib/CodeGen/CommandFlags.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'llvm/lib/CodeGen/CommandFlags.cpp') diff --git a/llvm/lib/CodeGen/CommandFlags.cpp b/llvm/lib/CodeGen/CommandFlags.cpp index fd52191882cb..48cd8e998ec9 100644 --- a/llvm/lib/CodeGen/CommandFlags.cpp +++ b/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 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 codegen::getExplicit##NAME() { \ + std::optional 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 DataSections( @@ -590,8 +592,8 @@ std::string codegen::getFeaturesStr() { if (getMCPU() == "native") { StringMap 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 codegen::getFeatureList() { if (getMCPU() == "native") { StringMap 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()) -- cgit v1.2.3