Fix cpplint errors that were not found so far

The class declaration regexp in cpplint did not catch classes decorated
by V8_EXPORT, V8_EXPORT_PRIVATE or any other decorator containing
digits.
This will be fixed in https://github.com/google/styleguide/pull/422.
This CL already prepares the code base by fixing all errors that will
be found after that change.
Some follow-up changes were needed to fix implicit conversion that are
not taken any more now.

R=mstarzinger@chromium.org

Bug: v8:8562
Cq-Include-Trybots: luci.chromium.try:linux_chromium_rel_ng
Change-Id: I03713bd04dbc3f54b89a6c857a93463139aa5efd
Reviewed-on: https://chromium-review.googlesource.com/c/1367751
Reviewed-by: Adam Klein <adamk@chromium.org>
Reviewed-by: Michael Starzinger <mstarzinger@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58143}
This commit is contained in:
Clemens Hammacher 2018-12-10 14:00:02 +01:00 committed by Commit Bot
parent 255048c5e2
commit cc636ba796
14 changed files with 39 additions and 25 deletions

View File

@ -4188,8 +4188,16 @@ class V8_EXPORT PropertyDescriptor {
// GenericDescriptor
PropertyDescriptor();
// DataDescriptor (implicit / DEPRECATED)
// Templatized such that the explicit constructor is chosen first.
// TODO(clemensh): Remove after 7.3 branch.
template <std::nullptr_t = nullptr>
V8_DEPRECATED(
"Use explicit constructor",
PropertyDescriptor(Local<Value> value)); // NOLINT(runtime/explicit)
// DataDescriptor
PropertyDescriptor(Local<Value> value);
explicit PropertyDescriptor(Local<Value> value);
// DataDescriptor with writable property
PropertyDescriptor(Local<Value> value, bool writable);
@ -4228,6 +4236,11 @@ class V8_EXPORT PropertyDescriptor {
PrivateData* private_;
};
// TODO(clemensh): Remove after 7.3 branch.
template <std::nullptr_t>
PropertyDescriptor::PropertyDescriptor(Local<Value> value)
: PropertyDescriptor(value) {}
/**
* An instance of the built-in Proxy constructor (ECMA-262, 6th Edition,
* 26.2.1).
@ -4436,7 +4449,7 @@ class V8_EXPORT WasmStreaming final {
public:
class WasmStreamingImpl;
WasmStreaming(std::unique_ptr<WasmStreamingImpl> impl);
explicit WasmStreaming(std::unique_ptr<WasmStreamingImpl> impl);
~WasmStreaming();

View File

@ -218,7 +218,7 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
template <typename T>
using LazyNode = std::function<TNode<T>()>;
CodeStubAssembler(compiler::CodeAssemblerState* state);
explicit CodeStubAssembler(compiler::CodeAssemblerState* state);
enum AllocationFlag : uint8_t {
kNone = 0,

View File

@ -457,8 +457,8 @@ class V8_EXPORT_PRIVATE Type {
friend UnionType;
friend size_t hash_value(Type type);
Type(bitset bits) : payload_(bits | 1u) {}
Type(TypeBase* type_base)
explicit Type(bitset bits) : payload_(bits | 1u) {}
Type(TypeBase* type_base) // NOLINT(runtime/explicit)
: payload_(reinterpret_cast<uintptr_t>(type_base)) {}
// Internal inspection.

View File

@ -67,7 +67,7 @@ class InterruptsScope;
// invocation.
class V8_EXPORT_PRIVATE StackGuard final {
public:
StackGuard(Isolate* isolate) : isolate_(isolate) {}
explicit StackGuard(Isolate* isolate) : isolate_(isolate) {}
// Pass the address beyond which the stack should not grow. The stack
// is assumed to grow downwards.

View File

@ -218,7 +218,7 @@ class V8_EXPORT_PRIVATE CallInterfaceDescriptor {
CallInterfaceDescriptor() : data_(nullptr) {}
virtual ~CallInterfaceDescriptor() = default;
CallInterfaceDescriptor(CallDescriptors::Key key)
explicit CallInterfaceDescriptor(CallDescriptors::Key key)
: data_(CallDescriptors::call_descriptor_data(key)) {}
Flags flags() const { return data()->flags(); }

View File

@ -49,7 +49,7 @@ class V8_EXPORT_PRIVATE ConstantArrayBuilder final {
static const size_t k32BitCapacity =
kMaxUInt32 - k16BitCapacity - k8BitCapacity + 1;
ConstantArrayBuilder(Zone* zone);
explicit ConstantArrayBuilder(Zone* zone);
// Generate a fixed array of constant handles based on inserted objects.
Handle<FixedArray> ToFixedArray(Isolate* isolate);

View File

@ -2025,7 +2025,7 @@ void InstanceBuilder::ProcessExports(Handle<WasmInstanceObject> instance) {
if (is_asm_js) {
// For modules arising from asm.js, honor the names section.
WireBytesRef func_name_ref = module_->LookupFunctionName(
module_object_->native_module()->wire_bytes(),
ModuleWireBytes(module_object_->native_module()->wire_bytes()),
function.func_index);
func_name = WasmModuleObject::ExtractUtf8StringFromModuleBytes(
isolate_, module_object_, func_name_ref)
@ -2212,7 +2212,7 @@ void InstanceBuilder::LoadTableSegments(Handle<WasmInstanceObject> instance) {
if (module_->origin == kAsmJsOrigin) {
// For modules arising from asm.js, honor the names section.
WireBytesRef func_name_ref = module_->LookupFunctionName(
native_module->wire_bytes(), func_index);
ModuleWireBytes(native_module->wire_bytes()), func_index);
func_name = WasmModuleObject::ExtractUtf8StringFromModuleBytes(
isolate_, module_object_, func_name_ref)
.ToHandleChecked();

View File

@ -129,12 +129,12 @@ class InterpreterHandle {
return {frame_base, frame_limit};
}
static Vector<const byte> GetBytes(WasmDebugInfo* debug_info) {
static ModuleWireBytes GetBytes(WasmDebugInfo* debug_info) {
// Return raw pointer into heap. The WasmInterpreter will make its own copy
// of this data anyway, and there is no heap allocation in-between.
NativeModule* native_module =
debug_info->wasm_instance()->module_object()->native_module();
return native_module->wire_bytes();
return ModuleWireBytes{native_module->wire_bytes()};
}
public:

View File

@ -242,7 +242,7 @@ std::shared_ptr<NativeModule> WasmEngine::ExportNativeModule(
Handle<WasmModuleObject> WasmEngine::ImportNativeModule(
Isolate* isolate, std::shared_ptr<NativeModule> shared_module) {
Vector<const byte> wire_bytes = shared_module->wire_bytes();
ModuleWireBytes wire_bytes(shared_module->wire_bytes());
const WasmModule* module = shared_module->module();
Handle<Script> script =
CreateWasmScript(isolate, wire_bytes, module->source_map_url);

View File

@ -202,7 +202,7 @@ size_t EstimateStoredSize(const WasmModule* module);
// on module_bytes, as this storage is only guaranteed to be alive as long as
// this struct is alive.
struct V8_EXPORT_PRIVATE ModuleWireBytes {
ModuleWireBytes(Vector<const byte> module_bytes)
explicit ModuleWireBytes(Vector<const byte> module_bytes)
: module_bytes_(module_bytes) {}
ModuleWireBytes(const byte* start, const byte* end)
: module_bytes_(start, static_cast<int>(end - start)) {

View File

@ -521,7 +521,7 @@ v8::debug::WasmDisassembly WasmModuleObject::DisassembleFunction(
static_cast<uint32_t>(func_index) >= module()->functions.size())
return {};
Vector<const byte> wire_bytes = native_module()->wire_bytes();
wasm::ModuleWireBytes wire_bytes(native_module()->wire_bytes());
std::ostringstream disassembly_os;
v8::debug::WasmDisassembly::OffsetTable offset_table;

View File

@ -175,10 +175,10 @@ class V8_EXPORT_PRIVATE ErrorThrower {
ErrorType error_type_ = kNone;
std::string error_msg_;
DISALLOW_COPY_AND_ASSIGN(ErrorThrower);
// ErrorThrower should always be stack-allocated, since it constitutes a scope
// (things happen in the destructor).
DISALLOW_NEW_AND_DELETE();
DISALLOW_COPY_AND_ASSIGN(ErrorThrower);
};
// Use {nullptr_t} as data value to indicate that this only stores the error,

View File

@ -576,10 +576,12 @@ bool IsSupportedVersion(Vector<const byte> version) {
}
MaybeHandle<WasmModuleObject> DeserializeNativeModule(
Isolate* isolate, Vector<const byte> data, Vector<const byte> wire_bytes) {
Isolate* isolate, Vector<const byte> data,
Vector<const byte> wire_bytes_vec) {
if (!IsWasmCodegenAllowed(isolate, isolate->native_context())) return {};
if (!IsSupportedVersion(data)) return {};
ModuleWireBytes wire_bytes(wire_bytes_vec);
// TODO(titzer): module features should be part of the serialization format.
WasmFeatures enabled_features = WasmFeaturesFromIsolate(isolate);
ModuleResult decode_result = DecodeWasmModule(
@ -591,7 +593,8 @@ MaybeHandle<WasmModuleObject> DeserializeNativeModule(
Handle<Script> script =
CreateWasmScript(isolate, wire_bytes, module->source_map_url);
OwnedVector<uint8_t> wire_bytes_copy = OwnedVector<uint8_t>::Of(wire_bytes);
OwnedVector<uint8_t> wire_bytes_copy =
OwnedVector<uint8_t>::Of(wire_bytes_vec);
Handle<WasmModuleObject> module_object = WasmModuleObject::New(
isolate, enabled_features, std::move(decode_result).value(),

View File

@ -1492,15 +1492,12 @@ TEST_F(WasmSignatureDecodeTest, Fail_invalid_param_type2) {
class WasmFunctionVerifyTest : public TestWithIsolateAndZone {
public:
WasmFeatures enabled_features_;
WasmModule module;
Vector<const byte> bytes;
FunctionResult DecodeWasmFunction(const ModuleWireBytes& wire_bytes,
const WasmModule* module,
const byte* function_start,
const byte* function_end) {
return DecodeWasmFunctionForTesting(enabled_features_, zone(), wire_bytes,
WasmFeatures enabled_features;
return DecodeWasmFunctionForTesting(enabled_features, zone(), wire_bytes,
module, function_start, function_end,
isolate()->counters());
}
@ -1521,8 +1518,9 @@ TEST_F(WasmFunctionVerifyTest, Ok_v_v_empty) {
kExprEnd // body
};
FunctionResult result =
DecodeWasmFunction(bytes, &module, data, data + sizeof(data));
WasmModule module;
FunctionResult result = DecodeWasmFunction(ModuleWireBytes({}), &module, data,
data + sizeof(data));
EXPECT_OK(result);
if (result.value() && result.ok()) {