clang-format

pull/13357/head
Mark D. Roth 8 years ago
parent 3228489f0b
commit d3984c32c8
  1. 1
      src/core/lib/support/debug_location.h
  2. 4
      src/core/lib/support/reference_counted.cc
  3. 2
      src/core/lib/support/reference_counted.h
  4. 8
      src/core/lib/support/reference_counted_ptr.h
  5. 4
      test/core/support/reference_counted_ptr_test.cc
  6. 4
      test/core/support/reference_counted_test.cc

@ -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_;

@ -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) {

@ -40,7 +40,7 @@ class ReferenceCounted {
protected:
// Allow Delete() to access destructor.
template<typename T>
template <typename T>
friend void Delete(T*);
explicit ReferenceCounted(TraceFlag* trace_flag) : trace_flag_(trace_flag) {

@ -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<typename T>
template <typename T>
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<typename T, typename... Args>
template <typename T, typename... Args>
inline ReferenceCountedPtr<T> MakeReferenceCounted(Args&&... args) {
return ReferenceCountedPtr<T>(New<T>(std::forward<Args>(args)...));
}

@ -41,9 +41,7 @@ class Foo : public ReferenceCounted {
int value_;
};
TEST(ReferenceCountedPtr, DefaultConstructor) {
ReferenceCountedPtr<Foo> foo;
}
TEST(ReferenceCountedPtr, DefaultConstructor) { ReferenceCountedPtr<Foo> foo; }
TEST(ReferenceCountedPtr, ExplicitConstructorEmpty) {
ReferenceCountedPtr<Foo> foo(nullptr);

@ -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;

Loading…
Cancel
Save