aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/CommandFlags.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2023-02-11 12:38:04 +0000
committerDimitry Andric <dim@FreeBSD.org>2023-02-11 12:38:11 +0000
commite3b557809604d036af6e00c60f012c2025b59a5e (patch)
tree8a11ba2269a3b669601e2fd41145b174008f4da8 /llvm/lib/CodeGen/CommandFlags.cpp
parent08e8dd7b9db7bb4a9de26d44c1cbfd24e869c014 (diff)
Diffstat (limited to 'llvm/lib/CodeGen/CommandFlags.cpp')
-rw-r--r--llvm/lib/CodeGen/CommandFlags.cpp16
1 files changed, 9 insertions, 7 deletions
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 <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())