mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-04 05:20:30 +00:00
AK: Allow NonnullRefPtr::ptr() when in "unknown" typestate.
Clang loses the typestate when passing NonnullRefPtr's via lambda captures. This is unfortunate, but not much we can do about it. Allowing ptr() makes it possible to use captured NonnullRefPtrs as you'd expect.
This commit is contained in:
parent
f46a1377ac
commit
afc638c3ab
Notes:
sideshowbarker
2024-07-19 13:03:54 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/afc638c3ab0
2 changed files with 7 additions and 3 deletions
|
@ -148,13 +148,13 @@ public:
|
|||
return *leakedPtr;
|
||||
}
|
||||
|
||||
CALLABLE_WHEN(unconsumed)
|
||||
CALLABLE_WHEN("unconsumed","unknown")
|
||||
T* ptr()
|
||||
{
|
||||
ASSERT(m_ptr);
|
||||
return m_ptr;
|
||||
}
|
||||
CALLABLE_WHEN(unconsumed)
|
||||
CALLABLE_WHEN("unconsumed","unknown")
|
||||
const T* ptr() const
|
||||
{
|
||||
ASSERT(m_ptr);
|
||||
|
|
|
@ -17,7 +17,11 @@
|
|||
# define RETURN_TYPESTATE(state) __attribute__((return_typestate(state)))
|
||||
#else
|
||||
# define CONSUMABLE(initial_state)
|
||||
# define CALLABLE_WHEN(state)
|
||||
# define CALLABLE_WHEN(...)
|
||||
# define SET_TYPESTATE(state)
|
||||
# define RETURN_TYPESTATE(state)
|
||||
#endif
|
||||
|
||||
#ifndef __serenity__
|
||||
#define PAGE_SIZE sysconf(_SC_PAGESIZE)
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue