Skip to content

Commit

Permalink
Run clang-tidy modernize-use-equals-{delete,default} on //gin
Browse files Browse the repository at this point in the history
See the bugs and cxx post for justification and details:
https://groups.google.com/a/chromium.org/forum/#!topic/cxx/RkOHzIK6Tq8

This change was done using clang-tidy as described here:
https://chromium.googlesource.com/chromium/src/+/lkcr/docs/clang_tidy.md

In some cases the the tool leaves behind a string of commas where it
replaced a member initializer list
(https://bugs.llvm.org/show_bug.cgi?id=35051). They were cleaned up with:
  git diff --name-only | \
    xargs sed -E -i 's/(^\s*|\)\s*):[ ,]*= default/\1 = default/'

BUG=778959,778957

Change-Id: Ib4d1680c615407583a6ad72ce51634d2f444db99
Reviewed-on: https://chromium-review.googlesource.com/789742
Reviewed-by: Jeremy Roman <jbroman@chromium.org>
Commit-Queue: Chris Watkins <watk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#520826}
  • Loading branch information
Chris Watkins authored and Commit Bot committed Dec 1, 2017
1 parent 070940d commit 756035a
Show file tree
Hide file tree
Showing 21 changed files with 34 additions and 65 deletions.
3 changes: 1 addition & 2 deletions gin/arguments.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ Arguments::Arguments(const v8::FunctionCallbackInfo<v8::Value>& info)
insufficient_arguments_(false) {
}

Arguments::~Arguments() {
}
Arguments::~Arguments() = default;

v8::Local<v8::Value> Arguments::PeekNext() const {
if (next_ >= info_->Length())
Expand Down
22 changes: 5 additions & 17 deletions gin/array_buffer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -231,15 +231,9 @@ ArrayBuffer::ArrayBuffer(v8::Isolate* isolate,
num_bytes_ = private_->length();
}

ArrayBuffer::~ArrayBuffer() {
}
ArrayBuffer::~ArrayBuffer() = default;

ArrayBuffer& ArrayBuffer::operator=(const ArrayBuffer& other) {
private_ = other.private_;
bytes_ = other.bytes_;
num_bytes_ = other.num_bytes_;
return *this;
}
ArrayBuffer& ArrayBuffer::operator=(const ArrayBuffer& other) = default;

// Converter<ArrayBuffer> -----------------------------------------------------

Expand All @@ -266,16 +260,10 @@ ArrayBufferView::ArrayBufferView(v8::Isolate* isolate,
num_bytes_(view->ByteLength()) {
}

ArrayBufferView::~ArrayBufferView() {
}

ArrayBufferView& ArrayBufferView::operator=(const ArrayBufferView& other) {
array_buffer_ = other.array_buffer_;
offset_ = other.offset_;
num_bytes_ = other.num_bytes_;
return *this;
}
ArrayBufferView::~ArrayBufferView() = default;

ArrayBufferView& ArrayBufferView::operator=(const ArrayBufferView& other) =
default;

// Converter<ArrayBufferView> -------------------------------------------------

Expand Down
3 changes: 1 addition & 2 deletions gin/dictionary.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ Dictionary::Dictionary(v8::Isolate* isolate,

Dictionary::Dictionary(const Dictionary& other) = default;

Dictionary::~Dictionary() {
}
Dictionary::~Dictionary() = default;

Dictionary Dictionary::CreateEmpty(v8::Isolate* isolate) {
Dictionary dictionary(isolate);
Expand Down
2 changes: 1 addition & 1 deletion gin/interceptor_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class MyInterceptor : public Wrappable<MyInterceptor>,
IndexedPropertyInterceptor(isolate, this),
value_(0),
template_cache_(isolate) {}
~MyInterceptor() override {}
~MyInterceptor() override = default;

// gin::Wrappable
ObjectTemplateBuilder GetObjectTemplateBuilder(
Expand Down
3 changes: 1 addition & 2 deletions gin/modules/file_module_provider.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ FileModuleProvider::FileModuleProvider(
: search_paths_(search_paths) {
}

FileModuleProvider::~FileModuleProvider() {
}
FileModuleProvider::~FileModuleProvider() = default;

void FileModuleProvider::AttempToLoadModules(
Runner* runner, const std::set<std::string>& ids) {
Expand Down
3 changes: 1 addition & 2 deletions gin/modules/module_registry.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ struct PendingModule {
Persistent<Value> factory;
};

PendingModule::PendingModule() {
}
PendingModule::PendingModule() = default;

PendingModule::~PendingModule() {
factory.Reset();
Expand Down
3 changes: 1 addition & 2 deletions gin/modules/module_runner_delegate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ ModuleRunnerDelegate::ModuleRunnerDelegate(
: module_provider_(search_paths) {
}

ModuleRunnerDelegate::~ModuleRunnerDelegate() {
}
ModuleRunnerDelegate::~ModuleRunnerDelegate() = default;

void ModuleRunnerDelegate::AddBuiltinModule(const std::string& id,
ModuleGetter getter) {
Expand Down
9 changes: 3 additions & 6 deletions gin/modules/timer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ Timer::Timer(v8::Isolate* isolate, bool repeating, int delay_ms,
base::Bind(&Timer::OnTimerFired, weak_factory_.GetWeakPtr()));
}

Timer::~Timer() {
}
Timer::~Timer() = default;

void Timer::OnTimerFired() {
// This can happen in spite of the weak callback because it is possible for
Expand Down Expand Up @@ -97,11 +96,9 @@ v8::Local<v8::Value> TimerModule::GetModule(v8::Isolate* isolate) {
return Create(isolate)->GetWrapper(isolate).ToLocalChecked();
}

TimerModule::TimerModule() {
}
TimerModule::TimerModule() = default;

TimerModule::~TimerModule() {
}
TimerModule::~TimerModule() = default;

ObjectTemplateBuilder TimerModule::GetObjectTemplateBuilder(
v8::Isolate* isolate) {
Expand Down
2 changes: 1 addition & 1 deletion gin/modules/timer_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class Result : public Wrappable<Result> {
Result() : count_(0) {
}

~Result() override {}
~Result() override = default;

ObjectTemplateBuilder GetObjectTemplateBuilder(
v8::Isolate* isolate) override {
Expand Down
3 changes: 1 addition & 2 deletions gin/object_template_builder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,7 @@ ObjectTemplateBuilder::ObjectTemplateBuilder(v8::Isolate* isolate)
ObjectTemplateBuilder::ObjectTemplateBuilder(
const ObjectTemplateBuilder& other) = default;

ObjectTemplateBuilder::~ObjectTemplateBuilder() {
}
ObjectTemplateBuilder::~ObjectTemplateBuilder() = default;

ObjectTemplateBuilder& ObjectTemplateBuilder::AddNamedPropertyInterceptor() {
template_->SetNamedPropertyHandler(&NamedPropertyGetter,
Expand Down
6 changes: 2 additions & 4 deletions gin/runner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,14 @@ namespace gin {
Runner::Runner() : weak_factory_(this) {
}

Runner::~Runner() {
}
Runner::~Runner() = default;

Runner::Scope::Scope(Runner* runner)
: isolate_scope_(runner->GetContextHolder()->isolate()),
handle_scope_(runner->GetContextHolder()->isolate()),
scope_(runner->GetContextHolder()->context()) {
}

Runner::Scope::~Scope() {
}
Runner::Scope::~Scope() = default;

} // namespace gin
9 changes: 3 additions & 6 deletions gin/shell_runner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,9 @@ using v8::Script;

namespace gin {

ShellRunnerDelegate::ShellRunnerDelegate() {
}
ShellRunnerDelegate::ShellRunnerDelegate() = default;

ShellRunnerDelegate::~ShellRunnerDelegate() {
}
ShellRunnerDelegate::~ShellRunnerDelegate() = default;

v8::Local<ObjectTemplate> ShellRunnerDelegate::GetGlobalTemplate(
ShellRunner* runner,
Expand Down Expand Up @@ -60,8 +58,7 @@ ShellRunner::ShellRunner(ShellRunnerDelegate* delegate, Isolate* isolate)
delegate_->DidCreateContext(this);
}

ShellRunner::~ShellRunner() {
}
ShellRunner::~ShellRunner() = default;

void ShellRunner::Run(const std::string& source,
const std::string& resource_name) {
Expand Down
3 changes: 1 addition & 2 deletions gin/test/file_runner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ FileRunnerDelegate::FileRunnerDelegate()
AddBuiltinModule(File::kModuleName, File::GetModule);
}

FileRunnerDelegate::~FileRunnerDelegate() {
}
FileRunnerDelegate::~FileRunnerDelegate() = default;

void FileRunnerDelegate::UnhandledException(ShellRunner* runner,
TryCatch& try_catch) {
Expand Down
6 changes: 2 additions & 4 deletions gin/test/v8_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,9 @@ using v8::HandleScope;

namespace gin {

V8Test::V8Test() {
}
V8Test::V8Test() = default;

V8Test::~V8Test() {
}
V8Test::~V8Test() = default;

void V8Test::SetUp() {
#ifdef V8_USE_EXTERNAL_STARTUP_DATA
Expand Down
3 changes: 1 addition & 2 deletions gin/try_catch.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ TryCatch::TryCatch(v8::Isolate* isolate)
: isolate_(isolate), try_catch_(isolate) {
}

TryCatch::~TryCatch() {
}
TryCatch::~TryCatch() = default;

bool TryCatch::HasCaught() {
return try_catch_.HasCaught();
Expand Down
2 changes: 1 addition & 1 deletion gin/v8_foreground_task_runner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ V8ForegroundTaskRunner::V8ForegroundTaskRunner(
DCHECK(task_runner_);
}

V8ForegroundTaskRunner::~V8ForegroundTaskRunner() {}
V8ForegroundTaskRunner::~V8ForegroundTaskRunner() = default;

void V8ForegroundTaskRunner::PostTask(std::unique_ptr<v8::Task> task) {
task_runner_->PostTask(FROM_HERE,
Expand Down
4 changes: 2 additions & 2 deletions gin/v8_foreground_task_runner_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

namespace gin {

V8ForegroundTaskRunnerBase::V8ForegroundTaskRunnerBase() {}
V8ForegroundTaskRunnerBase::V8ForegroundTaskRunnerBase() = default;

V8ForegroundTaskRunnerBase::~V8ForegroundTaskRunnerBase() {}
V8ForegroundTaskRunnerBase::~V8ForegroundTaskRunnerBase() = default;

void V8ForegroundTaskRunnerBase::EnableIdleTasks(
std::unique_ptr<V8IdleTaskRunner> idle_task_runner) {
Expand Down
2 changes: 1 addition & 1 deletion gin/v8_foreground_task_runner_with_locker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ V8ForegroundTaskRunnerWithLocker::V8ForegroundTaskRunnerWithLocker(
DCHECK(task_runner_);
}

V8ForegroundTaskRunnerWithLocker::~V8ForegroundTaskRunnerWithLocker() {}
V8ForegroundTaskRunnerWithLocker::~V8ForegroundTaskRunnerWithLocker() = default;

namespace {

Expand Down
2 changes: 1 addition & 1 deletion gin/v8_platform.cc
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ V8Platform* V8Platform::Get() { return g_v8_platform.Pointer(); }

V8Platform::V8Platform() : tracing_controller_(new TracingControllerImpl) {}

V8Platform::~V8Platform() {}
V8Platform::~V8Platform() = default;

void V8Platform::OnCriticalMemoryPressure() {
#if defined(OS_WIN)
Expand Down
3 changes: 1 addition & 2 deletions gin/wrappable.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@

namespace gin {

WrappableBase::WrappableBase() {
}
WrappableBase::WrappableBase() = default;

WrappableBase::~WrappableBase() {
wrapper_.Reset();
Expand Down
6 changes: 3 additions & 3 deletions gin/wrappable_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace gin {
class BaseClass {
public:
BaseClass() : value_(23) {}
virtual ~BaseClass() {}
virtual ~BaseClass() = default;

// So the compiler doesn't complain that |value_| is unused.
int value() const { return value_; }
Expand Down Expand Up @@ -51,7 +51,7 @@ class MyObject : public BaseClass,
return Wrappable<MyObject>::GetObjectTemplateBuilder(isolate)
.SetProperty("value", &MyObject::value, &MyObject::set_value);
}
~MyObject() override {}
~MyObject() override = default;

private:
int value_;
Expand All @@ -76,7 +76,7 @@ class MyCallableObject : public Wrappable<MyCallableObject> {
MyCallableObject() : result_(0) {
}

~MyCallableObject() override {}
~MyCallableObject() override = default;

void Call(int val1, int val2, int val3, const gin::Arguments& arguments) {
if (arguments.IsConstructCall())
Expand Down

0 comments on commit 756035a

Please sign in to comment.