Skip to content

Commit 87e977a

Browse files
addaleaxBridgeAR
authored andcommitted
test: make sure vtable is generated in addon test with LTO
PR-URL: #28057 Fixes: #28026 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Richard Lau <[email protected]>
1 parent 3feaf3d commit 87e977a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

test/addons/uv-handle-leak/binding.cc

+8-1
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,16 @@ void CloseCallback(uv_handle_t* handle) {}
1515

1616
class ExampleOwnerClass {
1717
public:
18-
virtual ~ExampleOwnerClass() {}
18+
virtual ~ExampleOwnerClass();
1919
};
2020

21+
// Do not inline this into the class, because that may remove the virtual
22+
// table when LTO is used, and with it the symbol for which we grep the process
23+
// output in test/abort/test-addon-uv-handle-leak.
24+
// When the destructor is not inlined, the compiler will have to assume that it,
25+
// and the vtable, is part of what this compilation unit exports, and keep them.
26+
ExampleOwnerClass::~ExampleOwnerClass() {}
27+
2128
ExampleOwnerClass example_instance;
2229

2330
void LeakHandle(const FunctionCallbackInfo<Value>& args) {

0 commit comments

Comments
 (0)