diff options
Diffstat (limited to 'lib/Support')
-rw-r--r-- | lib/Support/APFloat.cpp | 8 | ||||
-rw-r--r-- | lib/Support/Host.cpp | 1 | ||||
-rw-r--r-- | lib/Support/NativeFormatting.cpp | 5 | ||||
-rw-r--r-- | lib/Support/YAMLTraits.cpp | 26 |
4 files changed, 25 insertions, 15 deletions
diff --git a/lib/Support/APFloat.cpp b/lib/Support/APFloat.cpp index 30f0deab90a0..4cfbbf8645e0 100644 --- a/lib/Support/APFloat.cpp +++ b/lib/Support/APFloat.cpp @@ -76,8 +76,12 @@ namespace llvm { compile-time arithmetic on PPC double-double numbers, it is not able to represent all possible values held by a PPC double-double number, for example: (long double) 1.0 + (long double) 0x1p-106 - Should this be replaced by a full emulation of PPC double-double? */ - static const fltSemantics semPPCDoubleDouble = {0, 0, 0, 0}; + Should this be replaced by a full emulation of PPC double-double? + + Note: we need to make the value different from semBogus as otherwise + an unsafe optimization may collapse both values to a single address, + and we heavily rely on them having distinct addresses. */ + static const fltSemantics semPPCDoubleDouble = {-1, 0, 0, 0}; /* There are temporary semantics for the real PPCDoubleDouble implementation. Currently, APFloat of PPCDoubleDouble holds one PPCDoubleDoubleImpl as the diff --git a/lib/Support/Host.cpp b/lib/Support/Host.cpp index dd19eee15f62..49d0ed55a716 100644 --- a/lib/Support/Host.cpp +++ b/lib/Support/Host.cpp @@ -1069,6 +1069,7 @@ StringRef sys::getHostCPUName() { .Case("POWER7", "pwr7") .Case("POWER8", "pwr8") .Case("POWER8E", "pwr8") + .Case("POWER8NVL", "pwr8") .Case("POWER9", "pwr9") .Default(generic); } diff --git a/lib/Support/NativeFormatting.cpp b/lib/Support/NativeFormatting.cpp index bb8689141098..b951a88a38db 100644 --- a/lib/Support/NativeFormatting.cpp +++ b/lib/Support/NativeFormatting.cpp @@ -239,10 +239,7 @@ void llvm::write_double(raw_ostream &S, double N, FloatStyle Style, N *= 100.0; char Buf[32]; - unsigned Len; - Len = format(Spec.c_str(), N).snprint(Buf, sizeof(Buf)); - if (Style == FloatStyle::Percent) - ++Len; + format(Spec.c_str(), N).snprint(Buf, sizeof(Buf)); S << Buf; if (Style == FloatStyle::Percent) S << '%'; diff --git a/lib/Support/YAMLTraits.cpp b/lib/Support/YAMLTraits.cpp index 99d2070cb6ed..9849b3aa1ce9 100644 --- a/lib/Support/YAMLTraits.cpp +++ b/lib/Support/YAMLTraits.cpp @@ -118,6 +118,18 @@ void Input::beginMapping() { } } +std::vector<StringRef> Input::keys() { + MapHNode *MN = dyn_cast<MapHNode>(CurrentNode); + std::vector<StringRef> Ret; + if (!MN) { + setError(CurrentNode, "not a mapping"); + return Ret; + } + for (auto &P : MN->Mapping) + Ret.push_back(P.first()); + return Ret; +} + bool Input::preflightKey(const char *Key, bool Required, bool, bool &UseDefault, void *&SaveInfo) { UseDefault = false; @@ -163,7 +175,7 @@ void Input::endMapping() { if (!MN) return; for (const auto &NN : MN->Mapping) { - if (!MN->isValidKey(NN.first())) { + if (!is_contained(MN->ValidKeys, NN.first())) { setError(NN.second.get(), Twine("unknown key '") + NN.first() + "'"); break; } @@ -373,14 +385,6 @@ std::unique_ptr<Input::HNode> Input::createHNodes(Node *N) { } } -bool Input::MapHNode::isValidKey(StringRef Key) { - for (const char *K : ValidKeys) { - if (Key.equals(K)) - return true; - } - return false; -} - void Input::setError(const Twine &Message) { this->setError(CurrentNode, Message); } @@ -451,6 +455,10 @@ void Output::endMapping() { StateStack.pop_back(); } +std::vector<StringRef> Output::keys() { + report_fatal_error("invalid call"); +} + bool Output::preflightKey(const char *Key, bool Required, bool SameAsDefault, bool &UseDefault, void *&) { UseDefault = false; |