From 8eb34c50b997ff74e8b4bfb27abcbd03910c81b3 Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Sun, 13 May 2018 16:52:14 -0700 Subject: ClangTidy - Legacy cleanup: * use nullptr * converting integer literal to bool, use bool literal instead * annotate this function with 'override' or (rarely) 'final' * prefer using 'override' or (rarely) 'final' instead of 'virtual' PiperOrigin-RevId: 196441181 --- tensorflow/core/common_runtime/gpu/gpu_device_test.cc | 2 +- .../core/common_runtime/process_function_library_runtime_test.cc | 4 ++-- tensorflow/core/grappler/optimizers/arithmetic_optimizer.cc | 2 +- tensorflow/core/kernels/cudnn_rnn_ops.cc | 2 +- tensorflow/core/kernels/roll_op.cc | 2 +- tensorflow/tools/graph_transforms/transform_graph.cc | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tensorflow/core/common_runtime/gpu/gpu_device_test.cc b/tensorflow/core/common_runtime/gpu/gpu_device_test.cc index f3935f6ba2..bb00173d1e 100644 --- a/tensorflow/core/common_runtime/gpu/gpu_device_test.cc +++ b/tensorflow/core/common_runtime/gpu/gpu_device_test.cc @@ -29,7 +29,7 @@ const char* kDeviceNamePrefix = "/job:localhost/replica:0/task:0"; class GPUDeviceTest : public ::testing::Test { public: - void TearDown() { ProcessState::singleton()->TestOnlyReset(); } + void TearDown() override { ProcessState::singleton()->TestOnlyReset(); } protected: static SessionOptions MakeSessionOptions( diff --git a/tensorflow/core/common_runtime/process_function_library_runtime_test.cc b/tensorflow/core/common_runtime/process_function_library_runtime_test.cc index 4fbf2abc67..cce2308011 100644 --- a/tensorflow/core/common_runtime/process_function_library_runtime_test.cc +++ b/tensorflow/core/common_runtime/process_function_library_runtime_test.cc @@ -39,7 +39,7 @@ class TestClusterFLR : public DistributedFunctionLibraryRuntime { Status Instantiate(const string& function_name, const FunctionLibraryDefinition& lib_def, AttrSlice attrs, const FunctionLibraryRuntime::InstantiateOptions& options, - FunctionLibraryRuntime::LocalHandle* handle) { + FunctionLibraryRuntime::LocalHandle* handle) override { mutex_lock l(mu_); *handle = next_handle_; next_handle_++; @@ -49,7 +49,7 @@ class TestClusterFLR : public DistributedFunctionLibraryRuntime { void Run(const FunctionLibraryRuntime::Options& opts, FunctionLibraryRuntime::LocalHandle handle, gtl::ArraySlice args, std::vector* rets, - FunctionLibraryRuntime::DoneCallback done) {} + FunctionLibraryRuntime::DoneCallback done) override {} private: mutex mu_; diff --git a/tensorflow/core/grappler/optimizers/arithmetic_optimizer.cc b/tensorflow/core/grappler/optimizers/arithmetic_optimizer.cc index 30da23d212..cd7e742e5c 100644 --- a/tensorflow/core/grappler/optimizers/arithmetic_optimizer.cc +++ b/tensorflow/core/grappler/optimizers/arithmetic_optimizer.cc @@ -281,7 +281,7 @@ class ArithmeticOptimizerStage : public GraphOptimizerStage { const ArithmeticOptimizerContext ctx_ext) : GraphOptimizerStage("ArithmeticOptimizer", name, ctx), ctx_ext_(ctx_ext) {} - virtual ~ArithmeticOptimizerStage() = default; + ~ArithmeticOptimizerStage() override = default; protected: // Simplification graph rewrite can create additional nodes that are inputs diff --git a/tensorflow/core/kernels/cudnn_rnn_ops.cc b/tensorflow/core/kernels/cudnn_rnn_ops.cc index 02d4fc89c8..00ae32eb08 100644 --- a/tensorflow/core/kernels/cudnn_rnn_ops.cc +++ b/tensorflow/core/kernels/cudnn_rnn_ops.cc @@ -352,7 +352,7 @@ struct ToTFDataType : std::integral_constant {}; template class CudnnRnnAllocatorInTemp : public ScratchAllocator { public: - ~CudnnRnnAllocatorInTemp() = default; + ~CudnnRnnAllocatorInTemp() override = default; explicit CudnnRnnAllocatorInTemp(OpKernelContext* context) : context_(context) {} diff --git a/tensorflow/core/kernels/roll_op.cc b/tensorflow/core/kernels/roll_op.cc index 4b630809c5..96f94d80df 100644 --- a/tensorflow/core/kernels/roll_op.cc +++ b/tensorflow/core/kernels/roll_op.cc @@ -285,7 +285,7 @@ class RollOp : public OpKernel { dim_range[i] = dim_size_prod; } - Tensor* output = NULL; + Tensor* output = nullptr; OP_REQUIRES_OK(context, context->allocate_output(0, input.shape(), &output)); auto input_flat = input.flat().data(); diff --git a/tensorflow/tools/graph_transforms/transform_graph.cc b/tensorflow/tools/graph_transforms/transform_graph.cc index 3b9dd3dd2d..5cae8f8d8f 100644 --- a/tensorflow/tools/graph_transforms/transform_graph.cc +++ b/tensorflow/tools/graph_transforms/transform_graph.cc @@ -141,7 +141,7 @@ std::string ExpandPath(const std::string& path_string) { return path_string; } - const char* home = NULL; + const char* home = nullptr; std::string::size_type prefix = path_string.find_first_of('/'); if (path_string.length() == 1 || prefix == 1) { // The value of $HOME, e.g., ~/foo -- cgit v1.2.3