Skip to content

Commit

Permalink
More '= delete;' member functions.
Browse files Browse the repository at this point in the history
Generated by clang-tidy modernize-use-equals-delete
  • Loading branch information
chenshuo committed Oct 23, 2018
1 parent 14d7eb6 commit 52eb23a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
# Only run a few checks for now.
Checks: '-clang-*,clang-analyzer-security.*,google-runtime-references'
Checks: 'modernize-use-equals-delete'
WarningsAsErrors: ''
HeaderFilterRegex: ''
AnalyzeTemporaryDtors: false
Expand Down
6 changes: 3 additions & 3 deletions muduo/base/Singleton.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ template<typename T>
class Singleton : noncopyable
{
public:
Singleton() = delete;
~Singleton() = delete;

static T& instance()
{
pthread_once(&ponce_, &Singleton::init);
Expand All @@ -40,9 +43,6 @@ class Singleton : noncopyable
}

private:
Singleton();
~Singleton();

static void init()
{
value_ = new T();
Expand Down
5 changes: 2 additions & 3 deletions muduo/base/ThreadLocalSingleton.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ template<typename T>
class ThreadLocalSingleton : noncopyable
{
public:
ThreadLocalSingleton() = delete;
~ThreadLocalSingleton() = delete;

static T& instance()
{
Expand All @@ -35,9 +37,6 @@ class ThreadLocalSingleton : noncopyable
}

private:
ThreadLocalSingleton();
~ThreadLocalSingleton();

static void destructor(void* obj)
{
assert(obj == t_value_);
Expand Down
8 changes: 4 additions & 4 deletions muduo/base/noncopyable.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ namespace muduo

class noncopyable
{
public:
noncopyable(const noncopyable&) = delete;
void operator=(const noncopyable&) = delete;

protected:
noncopyable() = default;
~noncopyable() = default;

private:
noncopyable(const noncopyable&) = delete;
void operator=(const noncopyable&) = delete;
};

} // namespace muduo
Expand Down

0 comments on commit 52eb23a

Please sign in to comment.