ladybird/Tests/ClangPlugins/LibJSGCTests/Macros/wrong_classname_arg.cpp
Andreas Kling e87f889e31 Everywhere: Abandon Swift adoption
After making no progress on this for a very long time, let's acknowledge
it's not going anywhere and remove it from the codebase.
2026-02-17 10:48:09 -05:00

41 lines
1.3 KiB
C++

/*
* Copyright (c) 2024, Matthew Olsson <mattco@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
// RUN: %clang++ -Xclang -verify %plugin_opts% -c %s -o %t 2>&1
#include <LibJS/Runtime/PrototypeObject.h>
#include <LibWeb/Bindings/PlatformObject.h>
// An incorrect first argument for JS_PROTOTYPE_OBJECT is a compile error, so that is not tested
class TestCellClass : JS::Cell {
// expected-error@+1 {{Expected first argument of GC_CELL macro invocation to be TestCellClass}}
GC_CELL(bad, JS::Cell);
};
class TestObjectClass : JS::Object {
// expected-error@+1 {{Expected first argument of JS_OBJECT macro invocation to be TestObjectClass}}
JS_OBJECT(bad, JS::Object);
};
class TestEnvironmentClass : JS::Environment {
// expected-error@+1 {{Expected first argument of JS_ENVIRONMENT macro invocation to be TestEnvironmentClass}}
JS_ENVIRONMENT(bad, JS::Environment);
};
class TestPlatformClass : Web::Bindings::PlatformObject {
// expected-error@+1 {{Expected first argument of WEB_PLATFORM_OBJECT macro invocation to be TestPlatformClass}}
WEB_NON_IDL_PLATFORM_OBJECT(bad, Web::Bindings::PlatformObject);
};
struct Outer {
struct Inner;
};
struct Outer::Inner : JS::Cell {
// expected-error@+1 {{Expected first argument of GC_CELL macro invocation to be Outer::Inner}}
GC_CELL(Inner, JS::Cell);
};