Commit Graph

165 Commits

Author SHA1 Message Date
Ivan Krysak 9f1d9fd5d0 Use Container::contains() where appropriate 2023-07-02 15:06:11 +00:00
Ivan Krysak 5779cd878d KOCs: make more STL-like
This adds a couple of newer methods missing from these templates.
2023-07-02 15:06:11 +00:00
Ivan Krysak 4ab4d85ead STLExtras: remove incomplete iterator concepts 2023-07-02 15:06:11 +00:00
Ivan Krysak 37b8f80bf1 Concepts: introduce SpecializationOf
It was not available earlier because it required clang-13+
2023-07-02 17:05:52 +02:00
Ivan Krysak b927e26f94 Drop concepts provided by the standard library
We needed these because our libc++ version didn't provide them. Now that
that's no longer the case, they can be safely dropped.
2023-07-02 13:20:49 +02:00
Ivan Krysak a123ec2c35 Remove clang-format off around concepts
Now that clang-format no longer breaks anything involving a concept or
a requires clause on sight, these are no longer necessary
2023-07-02 13:20:49 +02:00
Ivan Krysak bc98e0079f Formatting: change PenaltyReturnTypeOnItsOwnLine
The new value is 21.
2023-07-02 13:20:49 +02:00
Ivan Krysak 01b4ec36c9 Formatting: set AllowShortEnumsOnASingleLine
The new value is `false`.
2023-07-02 13:15:08 +02:00
Ivan Krysak c523167302 Formatting: enforce access modifier whitespaces 2023-07-02 13:09:52 +02:00
Alessandro Di Federico 4c01d9c28d BidirectionalNode: implement edge removal 2023-06-30 13:38:27 +02:00
Alessandro Di Federico 5e72f8e31b ConstantRangeSet::dump: custom APInt formatter 2023-06-30 12:35:18 +02:00
Alessandro Di Federico 08b8b0bd9f ConstantRangeSet::size: fix corner case
In order to correctly represent the size of a 32-bit ConstantRange, you
need 33 bits.
2023-06-30 12:35:18 +02:00
Alessandro Di Federico b21861b7f9 GraphTraits<GenericGraph>: fix const support
GraphTraits were not fully usable in case of a `const` graph due to a
missing std::conditional_t for the definition of the `Node` type.
2023-06-30 12:35:18 +02:00
Ivan Krysak e3be901f1f STLExtras: allow skip to result in empty ranges
This only affects the case where the number of elements to be skipped
exactly matches the number of elements in the container.
2023-06-30 12:35:18 +02:00
Alessandro Di Federico 84dd10cbdb GenerichGraph.h: nullptr-initialize Edge::Neighbor 2023-06-30 12:35:18 +02:00
Ivan Krysak 02978910b0 STLExtras: introduce zip_pairs skip flavour
I found that it leads to better looking code when the check of whether
the range in question even has enough elements to skip is inside
the helper.

As such a separate type of skip entry point was introduced: one that
allows to iterate over the container pairwise

Now, instead of asserting, the loop just does nothing in cases like
```cpp
for (const auto &Element : zip_pairs(make_empty_range())
  do_stuff();
```
2023-05-25 06:25:07 +00:00
Ivan Krysak 5b2af637de Minor Changes 2023-05-25 06:25:07 +00:00
Giacomo Vercesi 31cd2b53f9 rcc: add codespell
Add codespell to the list of checks performed by
revng-check-conventions. This should reduce the amount of typos present
in the revng codebase.
2023-05-11 10:05:32 +02:00
Alessandro Di Federico 579b9a749f Introduce GenericGraph::operator= 2023-05-10 09:17:35 +02:00
Ivan Krysak 5034488766 GenericGraph: hasSuccessor and hasPredecessor
Older node types didn't have these helpers, so they were added
for compatibility.
2023-04-27 17:28:22 +02:00
Ivan Krysak 7ca012dbc3 Minor improvements 2023-04-27 17:28:22 +02:00
Massimo Fioravanti 69aafd4181 TupleTree: implement tracking data manipulation
Implement the core visits that are able to inspect the model bypassing
the instrumentation.
2023-04-21 17:51:05 +02:00
Massimo Fioravanti d65d73359d TrackingContainer: review API 2023-04-21 17:49:26 +02:00
Alessandro Di Federico dbcdad0a4d Switch from llvm::Optional to std::optional 2023-04-08 08:42:24 +02:00
Alessandro Di Federico 389342411a Drop makeArrayRef 2023-04-08 08:42:24 +02:00
Alessandro Di Federico 5ed9432a68 Fix ambiguous template function
Bumping LLVM version turned these into compiler errors.
2023-04-08 08:42:23 +02:00
Alessandro Di Federico 74ae629853 Drop experimental from coroutines 2023-04-08 08:42:23 +02:00
Alessandro Di Federico 52521f8cac Adopt more standard library's features 2023-04-08 08:42:23 +02:00
Alessandro Di Federico b2f22c168f Adopt clang-format 16 2023-04-08 08:42:23 +02:00
Ivan Krysak 9eb55f363b STLExtras: introduce some c++20 invocable concepts 2023-03-15 10:19:02 +01:00
Ivan Krysak 3904e525b0 SortedVector: improve new element insertion
This introduces `emplace` and `emplace_or_assign` members
allowing population of the container without copying values in.

It also reworks the batch insertion. On top of adding the ability
to move the elements in (without making a copy) and constructing
them in place, it also makes the non-assign version of the inserter
a lot safer by explicitly asserting the fact that while it was
in use no duplicates were added to the vector. Before now,
the duplicates were just silently removed from the container.

It also optimizes the batch insertion somewhat by using non-stable
`std::sort` for unique case as well as replacing `std::unique`
invocation with `std::find_adjacent`.
2023-03-15 10:19:02 +01:00
Ivan Krysak 64a4672f32 STLExtras: introduce ranges::views::as_rvalue 2023-03-15 10:19:01 +01:00
Ivan Krysak a06d9fedbd STLExtras: extend revng::find family 2023-03-15 10:19:01 +01:00
Ivan Krysak e79870e7c6 STLExtras: rework the skip range modifier
Note that all this is going to be obsolete once we can start using
the compiler with c++20 `views` support.
2023-03-15 10:19:01 +01:00
Ivan Krysak 11c0d7f02e Stop using \brief doxygen command 2023-03-15 10:19:01 +01:00
Ivan Krysak 0b1aaeaede Minor improvements 2023-03-15 10:19:01 +01:00
Massimo Fioravanti 230036d5b1 Introduce TrackingContainer
TrackingContainer is a wrapper around KeyedObjectContainers (notably,
SortedVector) intended to figure out which elements of the underlying
container have been accessed.
2023-02-16 10:58:02 +01:00
Massimo Fioravanti 4dc2e92782 Introduce DocumentError
`DocumentError`s are the inteded way of propagating errors from the
pipeline to the frontend when a location is required to inform the user
of the error whereabouts.
2023-02-09 13:42:50 +01:00
Massimo Fioravanti 0d3133cfc9 Fix missing includes
This ensures headers make sense on their own, without implicit
assumption about includers to also include other headers before them.
2022-12-09 18:09:39 +01:00
Ivan Krysak afdd3302d8 STLExtras: add constepxr version of find 2022-11-30 15:06:54 +01:00
Pietro Fezzardi 4334481894 UpcastablePointer: upcast with mutable callables 2022-11-15 14:15:20 +01:00
Giacomo Vercesi 0b80801b2b TupleTreeDiff: applyDiff uses ErrorList
Change how TupleTreeDiff and Visitor work so they can populate an
ErrorList in case the deserialization/apply of a diff fails.
2022-10-30 09:13:44 +01:00
Pietro Fezzardi 5f8dab184d Move ConstOrNot to Concepts.h 2022-10-29 16:46:19 +02:00
Massimo Fioravanti 445bc2aa8c Pipeline: introduce registry for container types 2022-09-29 15:52:26 +02:00
Ivan Krysak 9e098d2c9b GenericGraph: fix trait ordering and add inverse 2022-09-26 10:33:43 +02:00
Giacomo Vercesi d68640e2cb upcast: use universal references 2022-09-01 17:48:00 +02:00
Giacomo Vercesi 7d77d388b5 ConstexprString: allow default construction 2022-09-01 17:46:30 +02:00
Alessandro Di Federico f93eefda66 replaceAll: move to STLExtras.h 2022-08-31 18:07:47 +02:00
Alessandro Di Federico bdfcbdd8d9 Implement std::set intersection 2022-08-08 13:55:23 +02:00
Ivan Krysak 1ac6d6ea0d Introduce constexpr string splitter 2022-08-05 21:02:29 +03:00