about summary refs log tree commit diff
path: root/third_party/nix/src/libexpr (follow)
AgeCommit message (Collapse)AuthorFilesLines
2020-05-28 r/868 refactor(3p/nix): Introduce CMake as the build system for NixVincent Ambo1-0/+75
Completes the switch from Meson to CMake for the core build system in Nix. Meson was added originally because someone else had already done the work for integrating it in Nix and it was an upgrade from the previous setup. However over time it became clear that Meson is not quite mature enough for projects like Nix that have occasionally peculiar configuration constraints. Some issues encountered with Meson (some of these are due to the Meson setup in Nix): * Difficulty with generating correct compile_commands.json for external tools like clangd * Difficulty linking to libc++ when using clang * Ugly shell invocations for certain parts of the build system (I want these to be gone!!!) This CMake setup mimics the Meson configuration, but there are some differences (some temporary): * headers are now included separately for each library (see a previous commit that changes includes appropriately) * autoheaders-style configuration is currently hardcoded. Before blindly copying this I want to evaluate how much of it actually exists for portability concerns that I don't have (such as support for OS X). * Nix is built with libc++ by default. * [libstore] SQL schema is now inlined via a generated header, not an included string literal Abseil is still built as part of this build, rather than an external dependency, because it chokes on differently configured compiler invocations. Note that because of the move to libc++ an unwanted behaviour is introduced: glog log messages no longer have a body. I have yet to debug what is going on there.
2020-05-27 r/867 chore(3p/nix): Remove meson build files for core packagesVincent Ambo1-97/+0
2020-05-27 r/865 refactor(3p/nix): Anchor local includes at src/Vincent Ambo33-109/+107
Previously all includes were anchored in one global mess of header files. This moves the includes into filesystem "namespaces" (if you will) for each sub-package of Nix. Note: This commit does not introduce the relevant build system changes.
2020-05-25 r/846 refactor(3p/nix): Replace tokenizeStrings with absl::StrSplitVincent Ambo3-9/+14
This function was a custom (and inefficient in the case of single-character delimiters) string splitter which was used all over the codebase. Abseil provides an appropriate replacement function.
2020-05-25 r/845 refactor(3p/nix/libutil): Replace hasPrefix/Suffix with AbseilVincent Ambo3-9/+13
Uses the equivalent absl::StartsWith and absl::EndsWith functions instead.
2020-05-25 r/843 refactor(3p/nix/libutil): Replace string2Int & trim functionsVincent Ambo3-4/+9
Replaces these functions with corresponding functions from Abseil, namely absl::StripAsciiWhitespace and absl::SimpleAtoi. In the course of doing this some minor things I encountered along the way were also refactored. This also changes the signatures of the various custom readFile functions to use absl::string_view types.
2020-05-24 r/840 style(3p/nix): Remove 'using std::*' from types.hhVincent Ambo13-110/+123
It is considered bad form to use things from includes in headers, as these directives propagate to everywhere else and can make it confusing. types.hh (which is includes almost literally everywhere) had some of these directives, which this commit removes.
2020-05-24 r/835 refactor(3p/nix/libutil): Replace chomp() with absl::stringsVincent Ambo2-3/+9
2020-05-23 r/829 fix(3p/nix/libexpr): Ensure ExprOpUpdate merges into destinationVincent Ambo1-17/+5
... this fixes nixpkgs eval!
2020-05-23 r/828 refactor(3p/nix/libexpr): Make other 'const' in Bindings::mergeVincent Ambo2-8/+5
2020-05-23 r/827 fix(3p/nix/libexpr): Actually use AttributeMap type aliasVincent Ambo1-2/+2
Without this alias, the garbage-collecting allocator won't be used and allocated attribute set values won't be visible during GC.
2020-05-23 r/826 docs(3p/nix/libexpr): Add comment on ExprSelectVincent Ambo1-1/+8
2020-05-23 r/825 docs(3p/nix/libexpr): Add some comments about function callsVincent Ambo2-5/+10
These were things that took me a moment to realise.
2020-05-23 r/823 fix(3p/nix/libexpr): Fix attrNames/attrValues builtins for btree_mapVincent Ambo1-21/+9
Replaces the previous implementations which performed sorting with one that instead walks through the map (which is already sorted) and yields values from it. This fixes a handful of language tests because the previous implementation did not actually yield useful values on the new implementation.
2020-05-23 r/822 fix(3p/nix/libexpr): Ensure symbols are compared by valueVincent Ambo1-1/+1
2020-05-23 r/821 fix(3p/nix/libexpr): Remove the global empty attribute setVincent Ambo3-10/+0
In the change to the backing structure of attribute sets, the requirement to manually balance the capacity of the structure went away. This is a) because Abseil's data structures manage this on their own, and b) because the new Bindings class is allocated using `new (GC)` rather than writing into a predefined memory area. As part of this change functions related to the capacity were deprecated and set to 0 values, which in turn caused the creation of new attribute sets to return the same (mutable!) default value in various cases, leading to "side effects" that caused evaluation failures. FWIW, I'm not sure if this optimisation had noticeable performance impact, but while untangling libexpr it definitely doesn't help trying to follow what it's doing - so bye, bye!
2020-05-23 r/820 chore(3p/nix/libexpr): Minor readability improvements in eval/valueVincent Ambo4-19/+7
2020-05-23 r/819 chore(3p/nix/libexpr): Remove unused __overrides featureVincent Ambo1-47/+11
This feature does not appear in nixpkgs, so I don't care about it. My only goal is evaluating nixpkgs.
2020-05-23 r/818 chore(3p/nix/libexpr): Expose separate insert & "upsert" methodsVincent Ambo2-3/+10
Reading more through the old code, it seems like the intention /sometimes/ is to replace values.
2020-05-22 r/817 fix(3p/nix/libexpr): Use gc_allocator<T> as the btree_map allocatorVincent Ambo1-1/+8
This will make all Attr values visible to the GC.
2020-05-22 r/813 fix(3p/nix/libexpr): Do not allow duplicate attribute insertionVincent Ambo1-3/+17
This is closer to bug-for-bug compatibility with the previous version, which would put new elements at the end of the array and (due to the linear scan) return previous ones.
2020-05-22 r/806 refactor(3p/nix/libexpr): Use gc_cpp to allocate Value instancesVincent Ambo1-20/+4
2020-05-22 r/805 refactor(3p/nix/libexpr): state->allocBindings -> Bindings::NewGCVincent Ambo6-11/+10
EvalState::allocBindings had little to do with Bindings, other than returning them, and didn't belong in that class.
2020-05-22 r/804 fix(3p/nix/libexpr): Make new Bindings class visible to GCVincent Ambo2-6/+9
2020-05-22 r/803 chore(3p/nix/libexpr): Delete Bindings::sortVincent Ambo11-43/+6
This function does nothing anymore since the attributes are always in-order.
2020-05-22 r/802 fix(3p/nix): Update for usage of new attribute set APIVincent Ambo9-150/+159
The new attribute set API uses the iterators of the btree_map directly. This requires changes in various files because the internals of libexpr are very entangled. This code runs and compiles, but there is a bug causing empty attribute sets to be assigned incorrectly.
2020-05-22 r/801 refactor(3p/nix/libexpr): Use absl::btree_map::iterator typeVincent Ambo3-5/+11
Instead of using a custom Args* iterator, use the one belonging to the map type directly.
2020-05-22 r/800 refactor(3p/nix/libexpr): Use absl::btree_map::merge for '//'Vincent Ambo3-22/+14
Instead of doing some sort of inline merge-sort of the two attribute sets, use the attribute sets merge function. This commit alone does not build and is not supposed to.
2020-05-21 r/799 refactor(3p/nix/libexpr): Use absl::btree_map for AttrSetsVincent Ambo5-68/+84
This is the first step towards replacing the implementation of attribute sets with an absl::btree_map. Currently many access are done using array offsets and pointer arithmetic, so this change is currently causing Nix to fail in various ways.
2020-05-21 r/797 refactor(3p/nix/libexpr): Use std::string as qualified typeVincent Ambo25-183/+195
Replaces most uses of `string` with `std::string`. This came up because I removed the "types.hh" import from "symbol-table.hh", which percolated through a bunch of files where `string` was suddenly no longer defined ... *sigh*
2020-05-21 r/796 docs(3p/nix/libexpr): Add clarifying comments to SymbolTableVincent Ambo1-7/+19
2020-05-21 r/795 fix(3p/nix): Compatibility with updated SymbolTableVincent Ambo15-122/+126
The functions in SymbolTable have been renamed to match the Google Style guide, and some debug-only functions have been removed.
2020-05-21 r/794 refactor(3p/nix/libexpr): Use absl::node_hash_set in SymbolTableVincent Ambo3-32/+39
This replaces the previous use of std::unordered_set with absl::node_hash_set. This type was chosen because the current implementation requires pointer stability. This does not yet touch the 'Attr' struct. As a bonus, the implementation of the SymbolTable struct is now consolidated into a single header/implementation file pair.
2020-05-20 r/789 refactor(3p/nix): Apply clang-tidy's performance-* fixesVincent Ambo7-9/+10
This applies the performance fixes listed here: https://clang.llvm.org/extra/clang-tidy/checks/list.html
2020-05-20 r/788 refactor(3p/nix): Apply clang-tidy's readability-* fixesVincent Ambo9-120/+130
This applies the readability fixes listed here: https://clang.llvm.org/extra/clang-tidy/checks/list.html
2020-05-20 r/787 refactor(3p/nix): Apply clang-tidy's modernize-* fixesVincent Ambo8-33/+36
This applies the modernization fixes listed here: https://clang.llvm.org/extra/clang-tidy/checks/list.html The 'modernize-use-trailing-return-type' fix was excluded due to my personal preference (more specifically, I think the 'auto' keyword is misleading in that position).
2020-05-19 r/777 style(3p/nix): Final act in the brace-wrapping sagaVincent Ambo11-225/+382
This last change set was generated by a full clang-tidy run (including compilation): clang-tidy -p ~/projects/nix-build/ \ -checks=-*,readability-braces-around-statements -fix src/*/*.cc Actually running clang-tidy requires some massaging to make it play nice with Nix + meson, I'll be adding a wrapper or something for that soon.
2020-05-19 r/772 style(3p/nix): Add braces around single-line for-loopsVincent Ambo11-25/+75
These were not caught by the previous clang-tidy invocation, but were instead sorted out using amber[0] as such: ambr --regex 'for (\(.+\))\s([a-z].*;)' 'for $1 { $2 }' [0]: https://github.com/dalance/amber
2020-05-19 r/771 style(3p/nix): Add braces around single-line conditionalsVincent Ambo15-120/+332
These were not caught by the previous clang-tidy invocation, but were instead sorted out using amber[0] as such: ambr --regex 'if (\(.+\))\s([a-z].*;)' 'if $1 { $2 }' [0]: https://github.com/dalance/amber
2020-05-19 r/770 fix(3p/nix/libexpr): Declare value union types explicitlyVincent Ambo1-43/+59
Previously these structs were declared anonymously inside of the - anonymous - union. This is not actually supported by the C++ standard, but is merely a compiler-specific extension. Unfortunately untangling this required a forward-declaration of the Value type.
2020-05-19 r/769 fix(3p/nix/libexpr): Use noexcept instead of throw()Vincent Ambo1-1/+1
2020-05-19 r/768 fix(3p/nix): Fix incorrectly braced conditionals and loopsVincent Ambo9-39/+40
Fixes mistakes introduced by clang-tidy in the previous commit.
2020-05-19 r/767 style(3p/nix): Enforce braces around loops and conditionalsVincent Ambo12-154/+339
This change was generated with: fd -e cc -e hh | xargs -I{} clang-tidy {} -p ~/projects/nix-build/ \ --checks='-*,readability-braces-around-statements' --fix \ -fix-errors Some manual fixes were applied because some convoluted unbraced statements couldn't be untangled by clang-tidy. This commit still includes invalid files, but I decided to clean them up in a subsequent commit so that it becomes more obvious where clang-tidy failed. Maybe this will allow for a bug-report to clang-tidy.
2020-05-19 r/766 style(3p/nix): Reformat all includes to match new styleVincent Ambo26-12/+50
2020-05-19 r/760 style(3p/nix/libexpr): Reformat with clang-formatVincent Ambo5-6/+7
2020-05-19 r/758 refactor(3p/nix/libexpr): Replace logging.h with glogVincent Ambo8-35/+37
2020-05-17 r/748 chore(3p/nix): Always enable the garbage collectorVincent Ambo1-0/+1
It's unclear why this toggle existed, now it doesn't.
2020-05-17 r/741 chore(3p/nix): Remove old build system and other miscellaniesVincent Ambo1-33/+0
There are still remnants of the old build system (for example, the build derivations are not yet updated at all), but we'll get there.
2020-05-17 r/740 style(3p/nix): Reformat project in Google C++ styleVincent Ambo31-6304/+5888
Reformatted with: fd . -e hh -e cc | xargs clang-format -i
2020-05-17 r/739 fix(3p/nix): Fix Meson configuration for libexprVincent Ambo1-40/+3