experimental/optional -> optional

This commit is contained in:
Eelco Dolstra 2019-02-12 13:43:32 +01:00
parent 52419f8db3
commit c8a0b9d5cb
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE
15 changed files with 27 additions and 27 deletions

View file

@ -82,7 +82,7 @@ public:
/* The allowed filesystem paths in restricted or pure evaluation /* The allowed filesystem paths in restricted or pure evaluation
mode. */ mode. */
std::experimental::optional<PathSet> allowedPaths; std::optional<PathSet> allowedPaths;
Value vEmptySet; Value vEmptySet;

View file

@ -295,7 +295,7 @@ static bool getDerivation(EvalState & state, Value & v,
} }
std::experimental::optional<DrvInfo> getDerivation(EvalState & state, Value & v, std::optional<DrvInfo> getDerivation(EvalState & state, Value & v,
bool ignoreAssertionFailures) bool ignoreAssertionFailures)
{ {
Done done; Done done;

View file

@ -78,7 +78,7 @@ typedef list<DrvInfo> DrvInfos;
/* If value `v' denotes a derivation, return a DrvInfo object /* If value `v' denotes a derivation, return a DrvInfo object
describing it. Otherwise return nothing. */ describing it. Otherwise return nothing. */
std::experimental::optional<DrvInfo> getDerivation(EvalState & state, std::optional<DrvInfo> getDerivation(EvalState & state,
Value & v, bool ignoreAssertionFailures); Value & v, bool ignoreAssertionFailures);
void getDerivations(EvalState & state, Value & v, const string & pathPrefix, void getDerivations(EvalState & state, Value & v, const string & pathPrefix,

View file

@ -555,7 +555,7 @@ static void prim_derivationStrict(EvalState & state, const Pos & pos, Value * *
PathSet context; PathSet context;
std::experimental::optional<std::string> outputHash; std::optional<std::string> outputHash;
std::string outputHashAlgo; std::string outputHashAlgo;
bool outputHashRecursive = false; bool outputHashRecursive = false;

View file

@ -19,7 +19,7 @@ namespace nix {
std::regex revRegex("^[0-9a-fA-F]{40}$"); std::regex revRegex("^[0-9a-fA-F]{40}$");
GitInfo exportGit(ref<Store> store, const std::string & uri, GitInfo exportGit(ref<Store> store, const std::string & uri,
std::experimental::optional<std::string> ref, std::string rev, std::optional<std::string> ref, std::string rev,
const std::string & name) const std::string & name)
{ {
if (evalSettings.pureEval && rev == "") if (evalSettings.pureEval && rev == "")
@ -183,7 +183,7 @@ GitInfo exportGit(ref<Store> store, const std::string & uri,
static void prim_fetchGit(EvalState & state, const Pos & pos, Value * * args, Value & v) static void prim_fetchGit(EvalState & state, const Pos & pos, Value * * args, Value & v)
{ {
std::string url; std::string url;
std::experimental::optional<std::string> ref; std::optional<std::string> ref;
std::string rev; std::string rev;
std::string name = "source"; std::string name = "source";
PathSet context; PathSet context;

View file

@ -15,7 +15,7 @@ struct GitInfo
}; };
GitInfo exportGit(ref<Store> store, const std::string & uri, GitInfo exportGit(ref<Store> store, const std::string & uri,
std::experimental::optional<std::string> ref, std::string rev, std::optional<std::string> ref, std::string rev,
const std::string & name); const std::string & name);
extern std::regex revRegex; extern std::regex revRegex;

View file

@ -2413,7 +2413,7 @@ void DerivationGoal::writeStructuredAttrs()
objects consisting entirely of those values. (So nested objects consisting entirely of those values. (So nested
arrays or objects are not supported.) */ arrays or objects are not supported.) */
auto handleSimpleType = [](const nlohmann::json & value) -> std::experimental::optional<std::string> { auto handleSimpleType = [](const nlohmann::json & value) -> std::optional<std::string> {
if (value.is_string()) if (value.is_string())
return shellEscape(value); return shellEscape(value);
@ -3311,8 +3311,8 @@ void DerivationGoal::checkOutputs(const std::map<Path, ValidPathInfo> & outputs)
struct Checks struct Checks
{ {
bool ignoreSelfRefs = false; bool ignoreSelfRefs = false;
std::experimental::optional<uint64_t> maxSize, maxClosureSize; std::optional<uint64_t> maxSize, maxClosureSize;
std::experimental::optional<Strings> allowedReferences, allowedRequisites, disallowedReferences, disallowedRequisites; std::optional<Strings> allowedReferences, allowedRequisites, disallowedReferences, disallowedRequisites;
}; };
/* Compute the closure and closure size of some output. This /* Compute the closure and closure size of some output. This
@ -3359,7 +3359,7 @@ void DerivationGoal::checkOutputs(const std::map<Path, ValidPathInfo> & outputs)
info.path, closureSize, *checks.maxClosureSize); info.path, closureSize, *checks.maxClosureSize);
} }
auto checkRefs = [&](const std::experimental::optional<Strings> & value, bool allowed, bool recursive) auto checkRefs = [&](const std::optional<Strings> & value, bool allowed, bool recursive)
{ {
if (!value) return; if (!value) return;
@ -3413,7 +3413,7 @@ void DerivationGoal::checkOutputs(const std::map<Path, ValidPathInfo> & outputs)
if (maxClosureSize != output->end()) if (maxClosureSize != output->end())
checks.maxClosureSize = maxClosureSize->get<uint64_t>(); checks.maxClosureSize = maxClosureSize->get<uint64_t>();
auto get = [&](const std::string & name) -> std::experimental::optional<Strings> { auto get = [&](const std::string & name) -> std::optional<Strings> {
auto i = output->find(name); auto i = output->find(name);
if (i != output->end()) { if (i != output->end()) {
Strings res; Strings res;

View file

@ -16,7 +16,7 @@ ParsedDerivation::ParsedDerivation(const Path & drvPath, BasicDerivation & drv)
} }
} }
std::experimental::optional<std::string> ParsedDerivation::getStringAttr(const std::string & name) const std::optional<std::string> ParsedDerivation::getStringAttr(const std::string & name) const
{ {
if (structuredAttrs) { if (structuredAttrs) {
auto i = structuredAttrs->find(name); auto i = structuredAttrs->find(name);
@ -56,7 +56,7 @@ bool ParsedDerivation::getBoolAttr(const std::string & name, bool def) const
} }
} }
std::experimental::optional<Strings> ParsedDerivation::getStringsAttr(const std::string & name) const std::optional<Strings> ParsedDerivation::getStringsAttr(const std::string & name) const
{ {
if (structuredAttrs) { if (structuredAttrs) {
auto i = structuredAttrs->find(name); auto i = structuredAttrs->find(name);

View file

@ -8,22 +8,22 @@ class ParsedDerivation
{ {
Path drvPath; Path drvPath;
BasicDerivation & drv; BasicDerivation & drv;
std::experimental::optional<nlohmann::json> structuredAttrs; std::optional<nlohmann::json> structuredAttrs;
public: public:
ParsedDerivation(const Path & drvPath, BasicDerivation & drv); ParsedDerivation(const Path & drvPath, BasicDerivation & drv);
const std::experimental::optional<nlohmann::json> & getStructuredAttrs() const const std::optional<nlohmann::json> & getStructuredAttrs() const
{ {
return structuredAttrs; return structuredAttrs;
} }
std::experimental::optional<std::string> getStringAttr(const std::string & name) const; std::optional<std::string> getStringAttr(const std::string & name) const;
bool getBoolAttr(const std::string & name, bool def = false) const; bool getBoolAttr(const std::string & name, bool def = false) const;
std::experimental::optional<Strings> getStringsAttr(const std::string & name) const; std::optional<Strings> getStringsAttr(const std::string & name) const;
StringSet getRequiredSystemFeatures() const; StringSet getRequiredSystemFeatures() const;

View file

@ -149,7 +149,7 @@ public:
private: private:
ref<RemoteStore::Connection> openConnection() override; ref<RemoteStore::Connection> openConnection() override;
std::experimental::optional<std::string> path; std::optional<std::string> path;
}; };

View file

@ -2,7 +2,7 @@
#include <map> #include <map>
#include <list> #include <list>
#include <experimental/optional> #include <optional>
namespace nix { namespace nix {
@ -64,7 +64,7 @@ public:
/* Look up an item in the cache. If it exists, it becomes the most /* Look up an item in the cache. If it exists, it becomes the most
recently used item. */ recently used item. */
std::experimental::optional<Value> get(const Key & key) std::optional<Value> get(const Key & key)
{ {
auto i = data.find(key); auto i = data.find(key);
if (i == data.end()) return {}; if (i == data.end()) return {};

View file

@ -171,7 +171,7 @@ std::unique_ptr<Source> sinkToSource(
std::function<void(Sink &)> fun; std::function<void(Sink &)> fun;
std::function<void()> eof; std::function<void()> eof;
std::experimental::optional<coro_t::pull_type> coro; std::optional<coro_t::pull_type> coro;
bool started = false; bool started = false;
SinkToSource(std::function<void(Sink &)> fun, std::function<void()> eof) SinkToSource(std::function<void(Sink &)> fun, std::function<void()> eof)

View file

@ -965,7 +965,7 @@ std::vector<char *> stringsToCharPtrs(const Strings & ss)
string runProgram(Path program, bool searchPath, const Strings & args, string runProgram(Path program, bool searchPath, const Strings & args,
const std::experimental::optional<std::string> & input) const std::optional<std::string> & input)
{ {
RunOptions opts(program, args); RunOptions opts(program, args);
opts.searchPath = searchPath; opts.searchPath = searchPath;

View file

@ -14,7 +14,7 @@
#include <cstdio> #include <cstdio>
#include <map> #include <map>
#include <sstream> #include <sstream>
#include <experimental/optional> #include <optional>
#include <future> #include <future>
#ifndef HAVE_STRUCT_DIRENT_D_TYPE #ifndef HAVE_STRUCT_DIRENT_D_TYPE
@ -259,14 +259,14 @@ pid_t startProcess(std::function<void()> fun, const ProcessOptions & options = P
shell backtick operator). */ shell backtick operator). */
string runProgram(Path program, bool searchPath = false, string runProgram(Path program, bool searchPath = false,
const Strings & args = Strings(), const Strings & args = Strings(),
const std::experimental::optional<std::string> & input = {}); const std::optional<std::string> & input = {});
struct RunOptions struct RunOptions
{ {
Path program; Path program;
bool searchPath = true; bool searchPath = true;
Strings args; Strings args;
std::experimental::optional<std::string> input; std::optional<std::string> input;
Source * standardIn = nullptr; Source * standardIn = nullptr;
Sink * standardOut = nullptr; Sink * standardOut = nullptr;
bool _killStderr = false; bool _killStderr = false;

View file

@ -8,7 +8,7 @@ using namespace nix;
struct CmdAddToStore : MixDryRun, StoreCommand struct CmdAddToStore : MixDryRun, StoreCommand
{ {
Path path; Path path;
std::experimental::optional<std::string> namePart; std::optional<std::string> namePart;
CmdAddToStore() CmdAddToStore()
{ {