Commit e0b5b88e authored by Dan Elphick's avatar Dan Elphick Committed by Commit Bot

[cleanup] Fix warnings reported by clang-tidy

Fixes several warnings reported for internal repo by:
  * using vector::empty instead of vector::size() == 0
  * removing redundant return; at the end of a function
  * making operator= return OriginalType&

Bug: v8:9183
Change-Id: I8c725bd7b0bc011557fb2bb68a561ee413ab38f5
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1589978
Auto-Submit: Dan Elphick <delphick@chromium.org>
Reviewed-by: 's avatarMythri Alle <mythria@chromium.org>
Commit-Queue: Dan Elphick <delphick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#61149}
parent 55e8d613
......@@ -84,7 +84,7 @@ static void WriteLine(std::ostream& os, bool machine_format, const char* name,
stats.max_allocated_bytes_, stats.absolute_max_allocated_bytes_);
os << buffer;
if (stats.function_name_.size() > 0) {
if (!stats.function_name_.empty()) {
os << " " << stats.function_name_.c_str();
}
os << std::endl;
......
......@@ -568,7 +568,7 @@ bool FeedbackNexus::ConfigureMegamorphic(IcCheckType property_type) {
Map FeedbackNexus::GetFirstMap() const {
MapHandles maps;
ExtractMaps(&maps);
if (maps.size() > 0) return *maps.at(0);
if (!maps.empty()) return *maps.at(0);
return Map();
}
......
......@@ -7506,7 +7506,6 @@ void CompilationCacheTable::Remove(Object value) {
ElementRemoved();
}
}
return;
}
template <typename Derived, typename Shape>
......
......@@ -295,7 +295,6 @@ void String::StringShortPrint(StringStream* accumulator, bool show_details) {
}
if (show_details) accumulator->Put('>');
}
return;
}
void String::PrintUC16(std::ostream& os, int start, int end) { // NOLINT
......
......@@ -243,7 +243,7 @@ std::vector<char> ReadCharsFromFile(const char* filename, bool* exists,
}
std::string VectorToString(const std::vector<char>& chars) {
if (chars.size() == 0) {
if (chars.empty()) {
return std::string();
}
return std::string(chars.begin(), chars.end());
......
......@@ -574,9 +574,9 @@ class SetOncePointer {
pointer_ = value;
}
T* operator=(T* value) {
SetOncePointer& operator=(T* value) {
set(value);
return value;
return *this;
}
bool operator==(std::nullptr_t) const { return pointer_ == nullptr; }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment