You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by to...@apache.org on 2017/06/13 16:10:20 UTC
[2/5] kudu git commit: tidy: add and fix modernize-make-shared
tidy: add and fix modernize-make-shared
Also ran tidy --fix to apply these changes.
Change-Id: Ie859db564e9c91520bb2c74be9cdaa29753694f7
Reviewed-on: http://gerrit.cloudera.org:8080/7161
Reviewed-by: Dan Burkert <da...@apache.org>
Tested-by: Todd Lipcon <to...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/6b4284dd
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/6b4284dd
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/6b4284dd
Branch: refs/heads/master
Commit: 6b4284ddf93a6f14845d61fb0160794bb7d34e93
Parents: 9533c57
Author: Todd Lipcon <to...@cloudera.com>
Authored: Mon Jun 12 16:51:24 2017 -0700
Committer: Todd Lipcon <to...@apache.org>
Committed: Tue Jun 13 16:03:59 2017 +0000
----------------------------------------------------------------------
src/kudu/.clang-tidy | 2 +-
src/kudu/cfile/type_encodings.cc | 2 +-
src/kudu/cfile/type_encodings.h | 3 ++-
src/kudu/common/types.cc | 2 +-
src/kudu/common/types.h | 2 ++
src/kudu/integration-tests/external_mini_cluster.cc | 4 ++--
src/kudu/integration-tests/mini_cluster.cc | 4 ++--
src/kudu/tablet/lock_manager-test.cc | 15 +++++++--------
src/kudu/tools/ksck_remote.cc | 4 ++--
src/kudu/util/map-util-test.cc | 2 +-
10 files changed, 21 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/kudu/blob/6b4284dd/src/kudu/.clang-tidy
----------------------------------------------------------------------
diff --git a/src/kudu/.clang-tidy b/src/kudu/.clang-tidy
index e94a29d..0815904 100644
--- a/src/kudu/.clang-tidy
+++ b/src/kudu/.clang-tidy
@@ -14,7 +14,7 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-Checks: 'clang-diagnostic-*,clang-analyzer-*,-clang-analyzer-alpha*,-*,readability-*,-readability-braces-around-statements,llvm-include-order,misc-*,-modernize-*,performance-*,-readability-implicit-bool-cast,google-*,-google-readability-braces-around-statements,-readability-redundant-string-init'
+Checks: 'clang-diagnostic-*,clang-analyzer-*,-clang-analyzer-alpha*,-*,readability-*,-readability-braces-around-statements,llvm-include-order,misc-*,-modernize-*,performance-*,-readability-implicit-bool-cast,google-*,-google-readability-braces-around-statements,-readability-redundant-string-init,modernize-make-shared'
HeaderFilterRegex: '.*,-*.pb.h'
CheckOptions:
- key: readability-identifier-naming.ClassCase
http://git-wip-us.apache.org/repos/asf/kudu/blob/6b4284dd/src/kudu/cfile/type_encodings.cc
----------------------------------------------------------------------
diff --git a/src/kudu/cfile/type_encodings.cc b/src/kudu/cfile/type_encodings.cc
index 3eae786..4cc9e7c 100644
--- a/src/kudu/cfile/type_encodings.cc
+++ b/src/kudu/cfile/type_encodings.cc
@@ -280,7 +280,7 @@ class TypeEncodingResolver {
}
mapping_.insert(
make_pair(make_pair(type, encoding),
- shared_ptr<TypeEncodingInfo>(new TypeEncodingInfo(traits))));
+ std::make_shared<TypeEncodingInfo>(traits)));
}
unordered_map<pair<DataType, EncodingType>,
http://git-wip-us.apache.org/repos/asf/kudu/blob/6b4284dd/src/kudu/cfile/type_encodings.h
----------------------------------------------------------------------
diff --git a/src/kudu/cfile/type_encodings.h b/src/kudu/cfile/type_encodings.h
index 3a712d7..c9b8a4b 100644
--- a/src/kudu/cfile/type_encodings.h
+++ b/src/kudu/cfile/type_encodings.h
@@ -18,6 +18,7 @@
#define KUDU_CFILE_TYPE_ENCODINGS_H_
#include "kudu/common/common.pb.h"
+#include "kudu/util/make_shared.h"
#include "kudu/util/status.h"
namespace kudu {
@@ -52,7 +53,7 @@ class TypeEncodingInfo {
Status CreateBlockDecoder(BlockDecoder **bd, const Slice &slice,
CFileIterator *iter) const;
private:
-
+ ALLOW_MAKE_SHARED(TypeEncodingInfo);
friend class TypeEncodingResolver;
template<typename TypeEncodingTraitsClass> TypeEncodingInfo(TypeEncodingTraitsClass t);
http://git-wip-us.apache.org/repos/asf/kudu/blob/6b4284dd/src/kudu/common/types.cc
----------------------------------------------------------------------
diff --git a/src/kudu/common/types.cc b/src/kudu/common/types.cc
index df7e89f..f55c4e6 100644
--- a/src/kudu/common/types.cc
+++ b/src/kudu/common/types.cc
@@ -86,7 +86,7 @@ class TypeInfoResolver {
template<DataType type> void AddMapping() {
TypeTraits<type> traits;
- mapping_.insert(make_pair(type, shared_ptr<TypeInfo>(new TypeInfo(traits))));
+ mapping_.insert(make_pair(type, std::make_shared<TypeInfo>(traits)));
}
unordered_map<DataType,
http://git-wip-us.apache.org/repos/asf/kudu/blob/6b4284dd/src/kudu/common/types.h
----------------------------------------------------------------------
diff --git a/src/kudu/common/types.h b/src/kudu/common/types.h
index 2e8b40b..6e418dc 100644
--- a/src/kudu/common/types.h
+++ b/src/kudu/common/types.h
@@ -28,6 +28,7 @@
#include "kudu/gutil/mathlimits.h"
#include "kudu/gutil/strings/escaping.h"
#include "kudu/gutil/strings/numbers.h"
+#include "kudu/util/make_shared.h"
#include "kudu/util/slice.h"
namespace kudu {
@@ -68,6 +69,7 @@ class TypeInfo {
}
private:
+ ALLOW_MAKE_SHARED(TypeInfo);
friend class TypeInfoResolver;
template<typename Type> TypeInfo(Type t);
http://git-wip-us.apache.org/repos/asf/kudu/blob/6b4284dd/src/kudu/integration-tests/external_mini_cluster.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/external_mini_cluster.cc b/src/kudu/integration-tests/external_mini_cluster.cc
index bc9ab1b..3b1ac96 100644
--- a/src/kudu/integration-tests/external_mini_cluster.cc
+++ b/src/kudu/integration-tests/external_mini_cluster.cc
@@ -601,8 +601,8 @@ std::shared_ptr<MasterServiceProxy> ExternalMiniCluster::master_proxy() const {
std::shared_ptr<MasterServiceProxy> ExternalMiniCluster::master_proxy(int idx) const {
CHECK_LT(idx, masters_.size());
- return std::shared_ptr<MasterServiceProxy>(
- new MasterServiceProxy(messenger_, CHECK_NOTNULL(master(idx))->bound_rpc_addr()));
+ return std::make_shared<MasterServiceProxy>(
+ messenger_, CHECK_NOTNULL(master(idx))->bound_rpc_addr());
}
Status ExternalMiniCluster::CreateClient(client::KuduClientBuilder* builder,
http://git-wip-us.apache.org/repos/asf/kudu/blob/6b4284dd/src/kudu/integration-tests/mini_cluster.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/mini_cluster.cc b/src/kudu/integration-tests/mini_cluster.cc
index 549d2f2..60ac484 100644
--- a/src/kudu/integration-tests/mini_cluster.cc
+++ b/src/kudu/integration-tests/mini_cluster.cc
@@ -341,8 +341,8 @@ std::shared_ptr<MasterServiceProxy> MiniCluster::master_proxy() const {
}
std::shared_ptr<MasterServiceProxy> MiniCluster::master_proxy(int idx) const {
- return std::shared_ptr<MasterServiceProxy>(
- new MasterServiceProxy(messenger_, CHECK_NOTNULL(mini_master(idx))->bound_rpc_addr()));
+ return std::make_shared<MasterServiceProxy>(
+ messenger_, CHECK_NOTNULL(mini_master(idx))->bound_rpc_addr());
}
} // namespace kudu
http://git-wip-us.apache.org/repos/asf/kudu/blob/6b4284dd/src/kudu/tablet/lock_manager-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/lock_manager-test.cc b/src/kudu/tablet/lock_manager-test.cc
index f599e2b..fd55f2b 100644
--- a/src/kudu/tablet/lock_manager-test.cc
+++ b/src/kudu/tablet/lock_manager-test.cc
@@ -160,9 +160,8 @@ class LmTestThread {
std::vector<shared_ptr<ScopedRowLock> > locks;
// TODO: We don't have an API for multi-row
for (const Slice* key : keys_) {
- locks.push_back(shared_ptr<ScopedRowLock>(
- new ScopedRowLock(manager_, my_txn,
- *key, LockManager::LOCK_EXCLUSIVE)));
+ locks.push_back(std::make_shared<ScopedRowLock>(
+ manager_, my_txn, *key, LockManager::LOCK_EXCLUSIVE));
}
for (LmTestResource* r : resources_) {
@@ -249,8 +248,8 @@ TEST_F(LockManagerTest, TestContention) {
r != resources.end(); ++r) {
keys.push_back((*r)->id());
}
- threads.push_back(shared_ptr<LmTestThread>(
- new LmTestThread(&lock_manager_, keys, resources)));
+ threads.push_back(std::make_shared<LmTestThread>(
+ &lock_manager_, keys, resources));
}
runPerformanceTest("Contended", &threads);
}
@@ -269,7 +268,7 @@ TEST_F(LockManagerTest, TestUncontended) {
vector<shared_ptr<LmTestResource> > resources;
for (int i = 0; i < FLAGS_num_test_threads; i++) {
resources.push_back(
- shared_ptr<LmTestResource>(new LmTestResource(&slices[i])));
+ std::make_shared<LmTestResource>(&slices[i]));
}
vector<shared_ptr<LmTestThread> > threads;
for (int i = 0; i < FLAGS_num_test_threads; ++i) {
@@ -277,8 +276,8 @@ TEST_F(LockManagerTest, TestUncontended) {
k.push_back(&slices[i]);
vector<LmTestResource*> r;
r.push_back(resources[i].get());
- threads.push_back(shared_ptr<LmTestThread>(
- new LmTestThread(&lock_manager_, k, r)));
+ threads.push_back(std::make_shared<LmTestThread>(
+ &lock_manager_, k, r));
}
runPerformanceTest("Uncontended", &threads);
}
http://git-wip-us.apache.org/repos/asf/kudu/blob/6b4284dd/src/kudu/tools/ksck_remote.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tools/ksck_remote.cc b/src/kudu/tools/ksck_remote.cc
index 0a3d8e4..6b4d98f 100644
--- a/src/kudu/tools/ksck_remote.cc
+++ b/src/kudu/tools/ksck_remote.cc
@@ -350,8 +350,8 @@ Status RemoteKsckMaster::RetrieveTabletsList(const shared_ptr<KsckTable>& table)
new KsckTablet(table.get(), t->tablet().id()));
vector<shared_ptr<KsckTabletReplica>> replicas;
for (const auto* r : t->tablet().replicas()) {
- replicas.push_back(shared_ptr<KsckTabletReplica>(
- new KsckTabletReplica(r->ts().uuid(), r->is_leader())));
+ replicas.push_back(std::make_shared<KsckTabletReplica>(
+ r->ts().uuid(), r->is_leader()));
}
tablet->set_replicas(replicas);
tablets.push_back(tablet);
http://git-wip-us.apache.org/repos/asf/kudu/blob/6b4284dd/src/kudu/util/map-util-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/map-util-test.cc b/src/kudu/util/map-util-test.cc
index 1e818a2..eb456d3 100644
--- a/src/kudu/util/map-util-test.cc
+++ b/src/kudu/util/map-util-test.cc
@@ -91,7 +91,7 @@ TEST(EraseKeyReturnValuePtrTest, TestRawAndSmartSmartPointers) {
map<string, shared_ptr<string>> my_map2;
shared_ptr<string> value2 = EraseKeyReturnValuePtr(&my_map2, "key");
ASSERT_TRUE(value2.get() == nullptr);
- my_map2.emplace("key", shared_ptr<string>(new string("hello_world")));
+ my_map2.emplace("key", std::make_shared<string>("hello_world"));
value2 = EraseKeyReturnValuePtr(&my_map2, "key");
ASSERT_EQ(*value2, "hello_world");
map<string, string*> my_map_raw;