Skip to content

Commit

Permalink
test: make sure vtable is generated in addon test with LTO
Browse files Browse the repository at this point in the history
PR-URL: #28057
Fixes: #28026
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
  • Loading branch information
addaleax authored and danbev committed Jun 7, 2019
1 parent 65a5f7b commit b31bfad
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion test/addons/uv-handle-leak/binding.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,16 @@ void CloseCallback(uv_handle_t* handle) {}

class ExampleOwnerClass {
public:
virtual ~ExampleOwnerClass() {}
virtual ~ExampleOwnerClass();
};

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

ExampleOwnerClass example_instance;

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

0 comments on commit b31bfad

Please sign in to comment.