mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 09:00:22 +00:00
LibJS: Add RawNonnullGCPtr<T>
This is really just a type alias for NonnullGCPtr<T>, but it provides a way to have non-owning non-visited NonnullGCPtr<T> without getting yelled at by the Clang plugin for catching GC errors.
This commit is contained in:
parent
e240084437
commit
6a6618f5ea
Notes:
github-actions[bot]
2024-11-11 20:42:05 +00:00
Author: https://github.com/awesomekling Commit: https://github.com/LadybirdBrowser/ladybird/commit/6a6618f5eab Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2287 Reviewed-by: https://github.com/ADKaster
2 changed files with 6 additions and 1 deletions
|
@ -190,6 +190,10 @@ private:
|
||||||
template<typename T>
|
template<typename T>
|
||||||
using RawGCPtr = GCPtr<T>;
|
using RawGCPtr = GCPtr<T>;
|
||||||
|
|
||||||
|
// Non-Owning NonnullGCPtr
|
||||||
|
template<typename T>
|
||||||
|
using RawNonnullGCPtr = NonnullGCPtr<T>;
|
||||||
|
|
||||||
template<typename T, typename U>
|
template<typename T, typename U>
|
||||||
inline bool operator==(GCPtr<T> const& a, GCPtr<U> const& b)
|
inline bool operator==(GCPtr<T> const& a, GCPtr<U> const& b)
|
||||||
{
|
{
|
||||||
|
|
|
@ -61,6 +61,7 @@ static std::vector<clang::QualType> get_all_qualified_types(clang::QualType cons
|
||||||
"JS::GCPtr",
|
"JS::GCPtr",
|
||||||
"JS::NonnullGCPtr",
|
"JS::NonnullGCPtr",
|
||||||
"JS::RawGCPtr",
|
"JS::RawGCPtr",
|
||||||
|
"JS::RawNonnullGCPtr",
|
||||||
"JS::MarkedVector",
|
"JS::MarkedVector",
|
||||||
"JS::Handle",
|
"JS::Handle",
|
||||||
};
|
};
|
||||||
|
@ -110,7 +111,7 @@ static std::optional<QualTypeGCInfo> validate_qualified_type(clang::QualType con
|
||||||
OuterType outer_type;
|
OuterType outer_type;
|
||||||
if (template_type_name == "JS::GCPtr" || template_type_name == "JS::NonnullGCPtr") {
|
if (template_type_name == "JS::GCPtr" || template_type_name == "JS::NonnullGCPtr") {
|
||||||
outer_type = OuterType::GCPtr;
|
outer_type = OuterType::GCPtr;
|
||||||
} else if (template_type_name == "JS::RawGCPtr") {
|
} else if (template_type_name == "JS::RawGCPtr" || template_type_name == "JS::RawNonnullGCPtr") {
|
||||||
outer_type = OuterType::RawGCPtr;
|
outer_type = OuterType::RawGCPtr;
|
||||||
} else if (template_type_name == "JS::Handle") {
|
} else if (template_type_name == "JS::Handle") {
|
||||||
outer_type = OuterType::Handle;
|
outer_type = OuterType::Handle;
|
||||||
|
|
Loading…
Reference in a new issue