diff options
author | Kane York <kanepyork@gmail.com> | 2020-08-01T22·32-0700 |
---|---|---|
committer | kanepyork <rikingcoding@gmail.com> | 2020-08-01T22·45+0000 |
commit | 72fc2fd27e8ca9ddd6dad7f1c8f508e115aa2b60 (patch) | |
tree | eacd58ae5e0de9ffaadc265b8fd417f2f62d0433 /third_party/nix/src/libexpr/parser.cc | |
parent | cc3c45f739133162c840d500c0d633f46a524e06 (diff) |
fix(3p/nix): revert "apply all clang-tidy fixes" r/1534
This reverts commit ef54f5da9fa30b5c302f2a49595ee5d041f9706a. Resolved conflicts: third_party/nix/src/libexpr/eval.cc third_party/nix/src/libstore/builtins/fetchurl.cc third_party/nix/src/libstore/references.cc third_party/nix/src/libutil/hash.cc third_party/nix/src/nix-daemon/nix-daemon.cc Change-Id: Ib9cf6e96a79a23bde3983579ced3f92e530cb011 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1547 Reviewed-by: glittershark <grfn@gws.fyi> Tested-by: BuildkiteCI
Diffstat (limited to 'third_party/nix/src/libexpr/parser.cc')
-rw-r--r-- | third_party/nix/src/libexpr/parser.cc | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/third_party/nix/src/libexpr/parser.cc b/third_party/nix/src/libexpr/parser.cc index 7b477f3eae0a..a96d345cc126 100644 --- a/third_party/nix/src/libexpr/parser.cc +++ b/third_party/nix/src/libexpr/parser.cc @@ -85,10 +85,9 @@ void addAttr(ExprAttrs* attrs, AttrPath& attrPath, Expr* e, const Pos& pos) { } void addFormal(const Pos& pos, Formals* formals, const Formal& formal) { - if (formals->argNames.find(formal.name) != formals->argNames.end()) { + if (formals->argNames.find(formal.name) != formals->argNames.end()) throw ParseError(format("duplicate formal function argument '%1%' at %2%") % formal.name % pos); - } formals->formals.push_front(formal); formals->argNames.insert(formal.name); } @@ -119,9 +118,9 @@ Expr* stripIndentation(const Pos& pos, SymbolTable& symbols, } for (size_t j = 0; j < e->s.size(); ++j) { if (atStartOfLine) { - if (e->s[j] == ' ') { + if (e->s[j] == ' ') curIndent++; - } else if (e->s[j] == '\n') { + else if (e->s[j] == '\n') { /* Empty line, doesn't influence minimum indentation. */ curIndent = 0; @@ -197,11 +196,10 @@ Path resolveExprPath(Path path) { /* If `path' is a symlink, follow it. This is so that relative path references work. */ - struct stat st {}; + struct stat st; while (true) { - if (lstat(path.c_str(), &st)) { + if (lstat(path.c_str(), &st)) throw SysError(format("getting status of '%1%'") % path); - } if (!S_ISLNK(st.st_mode)) { break; } @@ -262,14 +260,13 @@ Path EvalState::findFile(SearchPath& searchPath, const std::string& path, const Pos& pos) { for (auto& i : searchPath) { std::string suffix; - if (i.first.empty()) { + if (i.first.empty()) suffix = "/" + path; - } else { + else { auto s = i.first.size(); if (path.compare(0, s, i.first) != 0 || - (path.size() > s && path[s] != '/')) { + (path.size() > s && path[s] != '/')) continue; - } suffix = path.size() == s ? "" : "/" + std::string(path, s); } auto r = resolveSearchPathElem(i); |