about summary refs log tree commit diff
path: root/third_party/nix/src/libexpr
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/nix/src/libexpr')
-rw-r--r--third_party/nix/src/libexpr/attr-set.hh4
-rw-r--r--third_party/nix/src/libexpr/eval.cc36
-rw-r--r--third_party/nix/src/libexpr/get-drvs.cc4
-rw-r--r--third_party/nix/src/libexpr/json-to-value.cc8
-rw-r--r--third_party/nix/src/libexpr/names.cc4
-rw-r--r--third_party/nix/src/libexpr/nixexpr.cc20
-rw-r--r--third_party/nix/src/libexpr/primops.cc8
-rw-r--r--third_party/nix/src/libexpr/primops/context.cc4
-rw-r--r--third_party/nix/src/libexpr/symbol-table.hh4
-rw-r--r--third_party/nix/src/libexpr/value-to-json.cc4
-rw-r--r--third_party/nix/src/libexpr/value-to-xml.cc4
11 files changed, 75 insertions, 25 deletions
diff --git a/third_party/nix/src/libexpr/attr-set.hh b/third_party/nix/src/libexpr/attr-set.hh
index 74a41a7e5d94..c62c3c690d24 100644
--- a/third_party/nix/src/libexpr/attr-set.hh
+++ b/third_party/nix/src/libexpr/attr-set.hh
@@ -70,7 +70,9 @@ class Bindings {
   std::vector<const Attr*> lexicographicOrder() const {
     std::vector<const Attr*> res;
     res.reserve(size_);
-    for (size_t n = 0; n < size_; n++) res.emplace_back(&attrs[n]);
+    for (size_t n = 0; n < size_; n++) {
+      res.emplace_back(&attrs[n]);
+    }
     std::sort(res.begin(), res.end(), [](const Attr* a, const Attr* b) {
       return (const string&)a->name < (const string&)b->name;
     });
diff --git a/third_party/nix/src/libexpr/eval.cc b/third_party/nix/src/libexpr/eval.cc
index a1965e08052b..0ceb4d750b7d 100644
--- a/third_party/nix/src/libexpr/eval.cc
+++ b/third_party/nix/src/libexpr/eval.cc
@@ -334,8 +334,12 @@ EvalState::EvalState(const Strings& _searchPath, ref<Store> store)
   /* Initialise the Nix expression search path. */
   if (!evalSettings.pureEval) {
     Strings paths = parseNixPath(getEnv("NIX_PATH", ""));
-    for (auto& i : _searchPath) addToSearchPath(i);
-    for (auto& i : paths) addToSearchPath(i);
+    for (auto& i : _searchPath) {
+      addToSearchPath(i);
+    }
+    for (auto& i : paths) {
+      addToSearchPath(i);
+    }
   }
   addToSearchPath("nix=" +
                   canonPath(settings.nixDataDir + "/nix/corepkgs", true));
@@ -354,7 +358,9 @@ EvalState::EvalState(const Strings& _searchPath, ref<Store> store)
       if (store->isInStore(r.second)) {
         PathSet closure;
         store->computeFSClosure(store->toStorePath(r.second), closure);
-        for (auto& path : closure) allowedPaths->insert(path);
+        for (auto& path : closure) {
+          allowedPaths->insert(path);
+        }
       } else
         allowedPaths->insert(r.second);
     }
@@ -558,7 +564,9 @@ Value& mkString(Value& v, const string& s, const PathSet& context) {
     size_t n = 0;
     v.string.context =
         (const char**)allocBytes((context.size() + 1) * sizeof(char*));
-    for (auto& i : context) v.string.context[n++] = dupString(i.c_str());
+    for (auto& i : context) {
+      v.string.context[n++] = dupString(i.c_str());
+    }
     v.string.context[n] = 0;
   }
   return v;
@@ -1415,7 +1423,9 @@ void EvalState::forceValueDeep(Value& v) {
           throw;
         }
     } else if (v.isList()) {
-      for (size_t n = 0; n < v.listSize(); ++n) recurse(*v.listElems()[n]);
+      for (size_t n = 0; n < v.listSize(); ++n) {
+        recurse(*v.listElems()[n]);
+      }
     }
   };
 
@@ -1477,7 +1487,9 @@ string EvalState::forceString(Value& v, const Pos& pos) {
 
 void copyContext(const Value& v, PathSet& context) {
   if (v.string.context)
-    for (const char** p = v.string.context; *p; ++p) context.insert(*p);
+    for (const char** p = v.string.context; *p; ++p) {
+      context.insert(*p);
+    }
 }
 
 string EvalState::forceString(Value& v, PathSet& context, const Pos& pos) {
@@ -1807,7 +1819,9 @@ void EvalState::printStats() {
     if (countCalls) {
       {
         auto obj = topObj.object("primops");
-        for (auto& i : primOpCalls) obj.attr(i.first, i.second);
+        for (auto& i : primOpCalls) {
+          obj.attr(i.first, i.second);
+        }
       }
       {
         auto list = topObj.list("functions");
@@ -1872,7 +1886,9 @@ size_t valueSize(Value& v) {
       case tString:
         sz += doString(v.string.s);
         if (v.string.context)
-          for (const char** p = v.string.context; *p; ++p) sz += doString(*p);
+          for (const char** p = v.string.context; *p; ++p) {
+            sz += doString(*p);
+          }
         break;
       case tPath:
         sz += doString(v.path);
@@ -1881,7 +1897,9 @@ size_t valueSize(Value& v) {
         if (seen.find(v.attrs) == seen.end()) {
           seen.insert(v.attrs);
           sz += sizeof(Bindings) + sizeof(Attr) * v.attrs->capacity();
-          for (auto& i : *v.attrs) sz += doValue(*i.value);
+          for (auto& i : *v.attrs) {
+            sz += doValue(*i.value);
+          }
         }
         break;
       case tList1:
diff --git a/third_party/nix/src/libexpr/get-drvs.cc b/third_party/nix/src/libexpr/get-drvs.cc
index ccbb09951f81..8897db4be9b1 100644
--- a/third_party/nix/src/libexpr/get-drvs.cc
+++ b/third_party/nix/src/libexpr/get-drvs.cc
@@ -171,7 +171,9 @@ StringSet DrvInfo::queryMetaNames() {
   if (!getMeta()) {
     return res;
   }
-  for (auto& i : *meta) res.insert(i.name);
+  for (auto& i : *meta) {
+    res.insert(i.name);
+  }
   return res;
 }
 
diff --git a/third_party/nix/src/libexpr/json-to-value.cc b/third_party/nix/src/libexpr/json-to-value.cc
index a7d9c4904c8e..51d001d8a530 100644
--- a/third_party/nix/src/libexpr/json-to-value.cc
+++ b/third_party/nix/src/libexpr/json-to-value.cc
@@ -82,7 +82,9 @@ static void parseJSON(EvalState& state, const char*& s, Value& v) {
     }
     s++;
     state.mkList(v, values.size());
-    for (size_t n = 0; n < values.size(); ++n) v.listElems()[n] = values[n];
+    for (size_t n = 0; n < values.size(); ++n) {
+      v.listElems()[n] = values[n];
+    }
   }
 
   else if (*s == '{') {
@@ -111,7 +113,9 @@ static void parseJSON(EvalState& state, const char*& s, Value& v) {
       s++;
     }
     state.mkAttrs(v, attrs.size());
-    for (auto& i : attrs) v.attrs->push_back(Attr(i.first, i.second));
+    for (auto& i : attrs) {
+      v.attrs->push_back(Attr(i.first, i.second));
+    }
     v.attrs->sort();
     s++;
   }
diff --git a/third_party/nix/src/libexpr/names.cc b/third_party/nix/src/libexpr/names.cc
index 92bd06308c69..f83ed9fe644b 100644
--- a/third_party/nix/src/libexpr/names.cc
+++ b/third_party/nix/src/libexpr/names.cc
@@ -99,7 +99,9 @@ int compareVersions(const string& v1, const string& v2) {
 
 DrvNames drvNamesFromArgs(const Strings& opArgs) {
   DrvNames result;
-  for (auto& i : opArgs) result.push_back(DrvName(i));
+  for (auto& i : opArgs) {
+    result.push_back(DrvName(i));
+  }
   return result;
 }
 
diff --git a/third_party/nix/src/libexpr/nixexpr.cc b/third_party/nix/src/libexpr/nixexpr.cc
index 4c0536f35cc1..bd171f816615 100644
--- a/third_party/nix/src/libexpr/nixexpr.cc
+++ b/third_party/nix/src/libexpr/nixexpr.cc
@@ -97,7 +97,9 @@ void ExprAttrs::show(std::ostream& str) const {
 
 void ExprList::show(std::ostream& str) const {
   str << "[ ";
-  for (auto& i : elems) str << "(" << *i << ") ";
+  for (auto& i : elems) {
+    str << "(" << *i << ") ";
+  }
   str << "]";
 }
 
@@ -294,7 +296,9 @@ void ExprAttrs::bindVars(const StaticEnv& env) {
 }
 
 void ExprList::bindVars(const StaticEnv& env) {
-  for (auto& i : elems) i->bindVars(env);
+  for (auto& i : elems) {
+    i->bindVars(env);
+  }
 }
 
 void ExprLambda::bindVars(const StaticEnv& env) {
@@ -324,7 +328,9 @@ void ExprLet::bindVars(const StaticEnv& env) {
   StaticEnv newEnv(false, &env);
 
   unsigned int displ = 0;
-  for (auto& i : attrs->attrs) newEnv.vars[i.first] = i.second.displ = displ++;
+  for (auto& i : attrs->attrs) {
+    newEnv.vars[i.first] = i.second.displ = displ++;
+  }
 
   for (auto& i : attrs->attrs)
     i.second.e->bindVars(i.second.inherited ? env : newEnv);
@@ -365,7 +371,9 @@ void ExprAssert::bindVars(const StaticEnv& env) {
 void ExprOpNot::bindVars(const StaticEnv& env) { e->bindVars(env); }
 
 void ExprConcatStrings::bindVars(const StaticEnv& env) {
-  for (auto& i : *es) i->bindVars(env);
+  for (auto& i : *es) {
+    i->bindVars(env);
+  }
 }
 
 void ExprPos::bindVars(const StaticEnv& env) {}
@@ -389,7 +397,9 @@ string ExprLambda::showNamePos() const {
 
 size_t SymbolTable::totalSize() const {
   size_t n = 0;
-  for (auto& i : symbols) n += i.size();
+  for (auto& i : symbols) {
+    n += i.size();
+  }
   return n;
 }
 
diff --git a/third_party/nix/src/libexpr/primops.cc b/third_party/nix/src/libexpr/primops.cc
index dfcfdeae431c..850d17a8f4a2 100644
--- a/third_party/nix/src/libexpr/primops.cc
+++ b/third_party/nix/src/libexpr/primops.cc
@@ -442,7 +442,9 @@ static void prim_genericClosure(EvalState& state, const Pos& pos, Value** args,
   /* Create the result list. */
   state.mkList(v, res.size());
   unsigned int n = 0;
-  for (auto& i : res) v.listElems()[n++] = i;
+  for (auto& i : res) {
+    v.listElems()[n++] = i;
+  }
 }
 
 static void prim_abort(EvalState& state, const Pos& pos, Value** args,
@@ -2061,7 +2063,9 @@ static void prim_replaceStrings(EvalState& state, const Pos& pos, Value** args,
         } else {
           p += i->size();
         }
-        for (auto& path : j->second) context.insert(path);
+        for (auto& path : j->second) {
+          context.insert(path);
+        }
         j->second.clear();
         break;
       }
diff --git a/third_party/nix/src/libexpr/primops/context.cc b/third_party/nix/src/libexpr/primops/context.cc
index 1ae3219f2c61..347b7a0a521e 100644
--- a/third_party/nix/src/libexpr/primops/context.cc
+++ b/third_party/nix/src/libexpr/primops/context.cc
@@ -35,7 +35,9 @@ static void prim_unsafeDiscardOutputDependency(EvalState& state, const Pos& pos,
   string s = state.coerceToString(pos, *args[0], context);
 
   PathSet context2;
-  for (auto& p : context) context2.insert(p.at(0) == '=' ? string(p, 1) : p);
+  for (auto& p : context) {
+    context2.insert(p.at(0) == '=' ? string(p, 1) : p);
+  }
 
   mkString(v, s, context2);
 }
diff --git a/third_party/nix/src/libexpr/symbol-table.hh b/third_party/nix/src/libexpr/symbol-table.hh
index 61a43ab978f4..8c27cf8ec723 100644
--- a/third_party/nix/src/libexpr/symbol-table.hh
+++ b/third_party/nix/src/libexpr/symbol-table.hh
@@ -54,7 +54,9 @@ class SymbolTable {
 
   template <typename T>
   void dump(T callback) {
-    for (auto& s : symbols) callback(s);
+    for (auto& s : symbols) {
+      callback(s);
+    }
   }
 };
 
diff --git a/third_party/nix/src/libexpr/value-to-json.cc b/third_party/nix/src/libexpr/value-to-json.cc
index 3da47dc2f85a..e4f1c285370c 100644
--- a/third_party/nix/src/libexpr/value-to-json.cc
+++ b/third_party/nix/src/libexpr/value-to-json.cc
@@ -50,7 +50,9 @@ void printValueAsJSON(EvalState& state, bool strict, Value& v,
       if (i == v.attrs->end()) {
         auto obj(out.object());
         StringSet names;
-        for (auto& j : *v.attrs) names.insert(j.name);
+        for (auto& j : *v.attrs) {
+          names.insert(j.name);
+        }
         for (auto& j : names) {
           Attr& a(*v.attrs->find(state.symbols.create(j)));
           auto placeholder(obj.placeholder(j));
diff --git a/third_party/nix/src/libexpr/value-to-xml.cc b/third_party/nix/src/libexpr/value-to-xml.cc
index 0e955c4ce267..a03924aa6354 100644
--- a/third_party/nix/src/libexpr/value-to-xml.cc
+++ b/third_party/nix/src/libexpr/value-to-xml.cc
@@ -29,7 +29,9 @@ static void showAttrs(EvalState& state, bool strict, bool location,
                       PathSet& drvsSeen) {
   StringSet names;
 
-  for (auto& i : attrs) names.insert(i.name);
+  for (auto& i : attrs) {
+    names.insert(i.name);
+  }
 
   for (auto& i : names) {
     Attr& a(*attrs.find(state.symbols.create(i)));