Age | Commit message (Collapse) | Author |
|
This stopped working quite some time ago due to Clang losing track of
typestates for some reason and everything becoming "unknown".
Since we're primarily using GCC anyway, it doesn't seem worth it to try
and maintain this non-working experiment for a secondary compiler.
Also it doesn't look like the Clang team is actively maintaining this
flag anyway. So good-bye, -Wconsumed. :/
|
|
It's tedious to write (and look at) [[gnu::always_inline]] etc. :^)
|
|
This turns into much less code in the most common cases, here's why:
The normal Optional usage pattern is something like:
auto foo = get_me_an_optional();
if (foo.has_value())
do_stuff_with(foo.value());
In this typical scenario, we check has_value() before calling value().
Without inlining, value() will double-check has_value() itself and
assert if it fails. Inlining allows the compiler to optimize all of
this away.
|
|
Move the "fast memcpy" stuff out of StdLibExtras.h and into Memory.h.
This will break a ton of things that were relying on StdLibExtras.h
to include a bunch of other headers. Fix will follow immediately after.
This makes it possible to include StdLibExtras.h from Types.h, which is
the main point of this exercise.
|
|
We can use __builtin_memset() without including <string.h>.
This is pretty neat, as it will allow us to reduce the header deps
of AK templates a bit, if applied consistently.
Note that this is an enabling change for an upcoming #include removal.
|
|
This was causing some obvious-in-hindsight but hard to spot bugs where
we'd implicitly convert the bool to an integer type and carry on with
the number 1 instead of the actual value().
|
|
|
|
This patch adds <LibCore/Forward.h> and uses it in various places to
shrink the header dependency graph.
|
|
|
|
As suggested by Joshua, this commit adds the 2-clause BSD license as a
comment block to the top of every source file.
For the first pass, I've just added myself for simplicity. I encourage
everyone to add themselves as copyright holders of any file they've
added or modified in some significant way. If I've added myself in
error somewhere, feel free to replace it with the appropriate copyright
holder instead.
Going forward, all new source files should include a license header.
|
|
We use consumable annotations to catch bugs where you get the .value()
of an Optional before verifying that it's okay.
The bug here was that only has_value() would set the consumed state,
even though operator bool() does the same job.
|
|
This replaces Optional<T>(U&&) which clang-tidy complained may hide the
regular copy and move constructors. That's a good point, clang-tidy,
and I appreciate you pointing that out!
|
|
Our protocol says we have to call has_value() before release_value().
The code was already safe, but the compiler had no way of knowing that.
|
|
We were *copying* the other Optional's value and then marking it as not
having a value. This prevented us from ever destroying the original.
|
|
We were forgetting to clear m_has_value in the Optional being moved
from when using operator=(Optional&&).
|
|
These will, when building with clang, prevent using Optional::value
without first checking Optional::has_value() - at compile time.
|
|
This allows HashMap::get() to be used for value types that cannot be default
constructed (e.g NonnullOwnPtr.)
|
|
This is like value() but with a fallback in case there's no value set.
|
|
This can be used to store any type, with a flag that says if any value
is present or not.
|