diff --git a/src/core/lib/support/debug_location.h b/src/core/lib/support/debug_location.h index 0095941ce3e..47c5082874c 100644 --- a/src/core/lib/support/debug_location.h +++ b/src/core/lib/support/debug_location.h @@ -28,6 +28,7 @@ class DebugLocation { bool Log() const { return true; } const char* file() const { return file_; } int line() const { return line_; } + private: const char* file_; const int line_; diff --git a/src/core/lib/support/reference_counted.cc b/src/core/lib/support/reference_counted.cc index 84ede18efe4..222628a6fab 100644 --- a/src/core/lib/support/reference_counted.cc +++ b/src/core/lib/support/reference_counted.cc @@ -34,9 +34,7 @@ void ReferenceCounted::Ref(const DebugLocation& location, const char* reason) { Ref(); } -void ReferenceCounted::Ref() { - gpr_ref(&refs_); -} +void ReferenceCounted::Ref() { gpr_ref(&refs_); } bool ReferenceCounted::Unref(const DebugLocation& location, const char* reason) { diff --git a/src/core/lib/support/reference_counted.h b/src/core/lib/support/reference_counted.h index 0076aa562ce..42bedcbd3ad 100644 --- a/src/core/lib/support/reference_counted.h +++ b/src/core/lib/support/reference_counted.h @@ -40,7 +40,7 @@ class ReferenceCounted { protected: // Allow Delete() to access destructor. - template + template friend void Delete(T*); explicit ReferenceCounted(TraceFlag* trace_flag) : trace_flag_(trace_flag) { diff --git a/src/core/lib/support/reference_counted_ptr.h b/src/core/lib/support/reference_counted_ptr.h index e4599a59659..37823809431 100644 --- a/src/core/lib/support/reference_counted_ptr.h +++ b/src/core/lib/support/reference_counted_ptr.h @@ -27,15 +27,13 @@ namespace grpc_core { // A smart pointer class for objects that provide Ref() and Unref() methods, // such as those provided by the ReferenceCounted base class. -template +template class ReferenceCountedPtr { public: ReferenceCountedPtr() {} // If value is non-null, we take ownership of a ref to it. - explicit ReferenceCountedPtr(T* value) { - value_ = value; - } + explicit ReferenceCountedPtr(T* value) { value_ = value; } // Move support. ReferenceCountedPtr(ReferenceCountedPtr&& other) { @@ -80,7 +78,7 @@ class ReferenceCountedPtr { T* value_ = nullptr; }; -template +template inline ReferenceCountedPtr MakeReferenceCounted(Args&&... args) { return ReferenceCountedPtr(New(std::forward(args)...)); } diff --git a/test/core/support/reference_counted_ptr_test.cc b/test/core/support/reference_counted_ptr_test.cc index f491622b695..942c7247245 100644 --- a/test/core/support/reference_counted_ptr_test.cc +++ b/test/core/support/reference_counted_ptr_test.cc @@ -41,9 +41,7 @@ class Foo : public ReferenceCounted { int value_; }; -TEST(ReferenceCountedPtr, DefaultConstructor) { - ReferenceCountedPtr foo; -} +TEST(ReferenceCountedPtr, DefaultConstructor) { ReferenceCountedPtr foo; } TEST(ReferenceCountedPtr, ExplicitConstructorEmpty) { ReferenceCountedPtr foo(nullptr); diff --git a/test/core/support/reference_counted_test.cc b/test/core/support/reference_counted_test.cc index 6613f06585c..c5795429c40 100644 --- a/test/core/support/reference_counted_test.cc +++ b/test/core/support/reference_counted_test.cc @@ -31,9 +31,7 @@ class Foo : public ReferenceCounted { Foo() : ReferenceCounted(nullptr) {} }; -TEST(ReferenceCounted, StackAllocated) { - Foo foo; -} +TEST(ReferenceCounted, StackAllocated) { Foo foo; } TEST(ReferenceCounted, StackAllocatedWithExtraRef) { Foo foo;