ClangTidy - Legacy cleanup:
authorA. Unique TensorFlower <gardener@tensorflow.org>
Sun, 13 May 2018 23:52:14 +0000 (16:52 -0700)
committerTensorFlower Gardener <gardener@tensorflow.org>
Sun, 13 May 2018 23:55:00 +0000 (16:55 -0700)
  * 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
tensorflow/core/common_runtime/process_function_library_runtime_test.cc
tensorflow/core/grappler/optimizers/arithmetic_optimizer.cc
tensorflow/core/kernels/cudnn_rnn_ops.cc
tensorflow/core/kernels/roll_op.cc
tensorflow/tools/graph_transforms/transform_graph.cc

index f3935f6..bb00173 100644 (file)
@@ -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(
index 4fbf2ab..cce2308 100644 (file)
@@ -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<Tensor> args, std::vector<Tensor>* rets,
-           FunctionLibraryRuntime::DoneCallback done) {}
+           FunctionLibraryRuntime::DoneCallback done) override {}
 
  private:
   mutex mu_;
index 30da23d..cd7e742 100644 (file)
@@ -281,7 +281,7 @@ class ArithmeticOptimizerStage : public GraphOptimizerStage<string> {
                                     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
index 02d4fc8..00ae32e 100644 (file)
@@ -352,7 +352,7 @@ struct ToTFDataType<uint8> : std::integral_constant<DataType, DT_UINT8> {};
 template <typename T>
 class CudnnRnnAllocatorInTemp : public ScratchAllocator {
  public:
-  ~CudnnRnnAllocatorInTemp() = default;
+  ~CudnnRnnAllocatorInTemp() override = default;
 
   explicit CudnnRnnAllocatorInTemp(OpKernelContext* context)
       : context_(context) {}
index 4b63080..96f94d8 100644 (file)
@@ -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<T>().data();
index 3b9dd3d..5cae8f8 100644 (file)
@@ -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