Skip to content

Commit

Permalink
[clang-tidy] No.26,27 enable misc-unused-using-decls,misc-unused-alia…
Browse files Browse the repository at this point in the history
…s-decls (#56485)

* fix

* fix
  • Loading branch information
enkilee authored Aug 29, 2023
1 parent cc9e869 commit 138bdf4
Show file tree
Hide file tree
Showing 45 changed files with 6 additions and 75 deletions.
4 changes: 2 additions & 2 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@ cppcoreguidelines-c-copy-assignment-signature,
-cppcoreguidelines-slicing,
-hicpp-avoid-goto,
-hicpp-exception-baseclass,
-misc-unused-alias-decls,
-misc-unused-using-decls,
misc-unused-alias-decls,
misc-unused-using-decls,
modernize-avoid-bind,
modernize-avoid-c-arrays,
-modernize-deprecated-headers,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ namespace paddle {
namespace distributed {
namespace auto_parallel {

using phi::distributed::auto_parallel::str_join;

std::pair<std::vector<TensorDistAttr>, std::vector<TensorDistAttr>>
ReplicatedSPMDRule::InferForward(const std::vector<DistTensorSpec>& input_specs,
const paddle::framework::AttributeMap& attrs) {
Expand Down
3 changes: 0 additions & 3 deletions paddle/fluid/framework/ir/graph_pattern_detector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ namespace paddle {
namespace framework {
namespace ir {

using string::PrettyLog;
using string::Style;

size_t PDPattern::id_ = 0UL;

#ifdef PADDLE_WITH_TENSORRT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ namespace framework {
namespace ir {

using paddle::operators::OpAndGradOpPair;
using paddle::operators::OpVariant;
using paddle::operators::OpVariantSet;

void RecurrentOpEagerDeletionPass::ApplyImpl(Graph *graph) const {
Expand Down
1 change: 0 additions & 1 deletion paddle/fluid/inference/analysis/ir_pass_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
namespace paddle {
namespace inference {
namespace analysis {
using string::PrettyLog;
using string::PrettyLogEndl;
using string::Style;

Expand Down
2 changes: 1 addition & 1 deletion paddle/fluid/inference/api/analysis_predictor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ void UpdatePrivateDeviceContext(InferGPUContext *gpu_context,
#endif
} // namespace

using inference::Singleton;
#ifdef PADDLE_WITH_TENSORRT
using inference::tensorrt::TRTCalibratorEngine;
using inference::tensorrt::TRTCalibratorEngineManager;
Expand Down Expand Up @@ -2527,6 +2526,7 @@ void AnalysisPredictor::ClearIntermediateTensor() {
}

#ifdef PADDLE_WITH_TENSORRT
using inference::Singleton;
bool AnalysisPredictor::SaveTrtCalibToDisk() {
PADDLE_ENFORCE_EQ(config_.tensorrt_engine_enabled(),
true,
Expand Down
1 change: 0 additions & 1 deletion paddle/fluid/inference/api/mkldnn_quantizer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ namespace paddle {

using framework::Variable;
using framework::ir::Graph;
using phi::CPUPlace;
using ConstEigenVectorArrayMap =
Eigen::Map<const Eigen::Array<float, Eigen::Dynamic, 1>>;
using EigenMatrixDoubleArray =
Expand Down
1 change: 0 additions & 1 deletion paddle/fluid/operators/activation_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,6 @@ DEFINE_ACTIVATION_CPU_KERNEL(SoftRelu, SoftReluFunctor, SoftReluGradFunctor)
} // namespace paddle

namespace ops = paddle::operators;
namespace plat = paddle::platform;

#define REGISTER_ACTIVATION_OP(KERNEL_TYPE, OP_NAME, functor, grad_functor) \
REGISTER_OPERATOR( \
Expand Down
1 change: 0 additions & 1 deletion paddle/fluid/operators/add_position_encoding_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ class AddPositionEncodingGradOpMaker : public framework::SingleGradOpMaker<T> {
} // namespace paddle

namespace ops = paddle::operators;
namespace plt = paddle::platform;

REGISTER_OPERATOR(
add_position_encoding,
Expand Down
1 change: 0 additions & 1 deletion paddle/fluid/operators/assign_pos_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ specially counter orderingly.
} // namespace paddle

namespace ops = paddle::operators;
namespace plat = paddle::platform;

REGISTER_OP_WITHOUT_GRADIENT(assign_pos,
ops::AssignPosOp,
Expand Down
1 change: 0 additions & 1 deletion paddle/fluid/operators/center_loss_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ DECLARE_NO_NEED_BUFFER_VARS_INFERER(CenterLossGradNoNeedBufVarsInferer, "X");
} // namespace paddle

namespace ops = paddle::operators;
namespace plat = paddle::platform;

REGISTER_OPERATOR(center_loss,
ops::CenterLossOp,
Expand Down
1 change: 0 additions & 1 deletion paddle/fluid/operators/flatten_op.cu.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ limitations under the License. */
#include "paddle/fluid/operators/flatten_op.h"

namespace ops = paddle::operators;
namespace plat = paddle::platform;

REGISTER_OP_CUDA_KERNEL(flatten,
ops::FlattenKernel<phi::GPUContext, float>,
Expand Down
1 change: 0 additions & 1 deletion paddle/fluid/operators/fused/fused_seqpool_cvm_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,6 @@ class FusedSeqpoolCVMGradOpMaker : public framework::SingleGradOpMaker<T> {
} // namespace paddle

namespace ops = paddle::operators;
namespace plat = paddle::platform;

REGISTER_OPERATOR(fused_seqpool_cvm,
ops::FusedSeqpoolCVMOp,
Expand Down
1 change: 0 additions & 1 deletion paddle/fluid/operators/limit_by_capacity_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ class LimitByCapacityOpMaker : public framework::OpProtoAndCheckerMaker {
} // namespace paddle

namespace ops = paddle::operators;
namespace plat = paddle::platform;

REGISTER_OP_WITHOUT_GRADIENT(limit_by_capacity,
ops::LimitByCapacityOp,
Expand Down
1 change: 0 additions & 1 deletion paddle/fluid/operators/memcpy_d2h_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ raise error if the type is not listed above.
} // namespace paddle

namespace ops = paddle::operators;
namespace plat = paddle::platform;

DECLARE_INFER_SHAPE_FUNCTOR(memcpy_d2h,
MemcpyD2HInferShapeFunctor,
Expand Down
1 change: 0 additions & 1 deletion paddle/fluid/operators/memcpy_h2d_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ raise error if the type is not listed above.
} // namespace paddle

namespace ops = paddle::operators;
namespace plat = paddle::platform;

DECLARE_INFER_SHAPE_FUNCTOR(memcpy_h2d,
MemcpyH2DInferShapeFunctor,
Expand Down
1 change: 0 additions & 1 deletion paddle/fluid/operators/memcpy_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ raise error if the type is not listed above.
} // namespace paddle

namespace ops = paddle::operators;
namespace plat = paddle::platform;

DECLARE_INFER_SHAPE_FUNCTOR(memcpy,
MemcpyInferShapeFunctor,
Expand Down
4 changes: 0 additions & 4 deletions paddle/fluid/operators/mkldnn/interpolate_mkldnn_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,7 @@ namespace paddle {
namespace operators {

using dnnl::memory;
using dnnl::primitive;
using dnnl::reorder;
using dnnl::resampling_forward;
using dnnl::stream;
using phi::DataLayout;
using OneDNNMemoryFormat = dnnl::memory::format_tag;

template <typename T = float>
Expand Down
4 changes: 0 additions & 4 deletions paddle/fluid/operators/mkldnn/quantize_mkldnn_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ namespace paddle {
namespace operators {

using dnnl::memory;
using dnnl::primitive;
using dnnl::reorder;
using dnnl::stream;
using phi::DataLayout;

template <typename T>
class QuantOpKernel : public framework::OpKernel<T> {
Expand Down
1 change: 0 additions & 1 deletion paddle/fluid/operators/mkldnn/requantize_mkldnn_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ namespace paddle {
namespace operators {

using dnnl::memory;
using dnnl::reorder;

namespace {

Expand Down
1 change: 0 additions & 1 deletion paddle/fluid/operators/number_count_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ class NumberCountOpMaker : public framework::OpProtoAndCheckerMaker {
} // namespace paddle

namespace ops = paddle::operators;
namespace plat = paddle::platform;

REGISTER_OP_WITHOUT_GRADIENT(number_count,
ops::NumberCountOp,
Expand Down
2 changes: 1 addition & 1 deletion paddle/fluid/operators/optimizers/adadelta_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ param\_out = param + param\_update
} // namespace paddle

namespace ops = paddle::operators;
namespace ops = paddle::operators;

DECLARE_INFER_SHAPE_FUNCTOR(adadelta,
AdadeltaInferMetaFunctor,
PD_INFER_META(phi::AdadeltaInferMeta));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ class DistributedFusedLambInitOpMaker
} // namespace paddle

namespace ops = paddle::operators;
namespace plat = paddle::platform;

REGISTER_OP_WITHOUT_GRADIENT(distributed_fused_lamb_init,
ops::DistributedFusedLambInitOp,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ class DistributedFusedLambOpMaker : public framework::OpProtoAndCheckerMaker {
} // namespace operators
} // namespace paddle

namespace plat = paddle::platform;
namespace ops = paddle::operators;
REGISTER_OP_WITHOUT_GRADIENT(distributed_fused_lamb,
ops::DistributedFusedLambOp,
Expand Down
1 change: 0 additions & 1 deletion paddle/fluid/operators/p_send_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ class PSendArrayOpMaker : public framework::OpProtoAndCheckerMaker {
} // namespace paddle

namespace ops = paddle::operators;
namespace plat = paddle::platform;

DECLARE_INFER_SHAPE_FUNCTOR(p_send,
PSendInferShapeFunctor,
Expand Down
1 change: 0 additions & 1 deletion paddle/fluid/operators/print_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ class OpBase;

namespace paddle {
namespace operators {
using framework::GradVarName;

#define CLOG std::cout

Expand Down
3 changes: 1 addition & 2 deletions paddle/fluid/operators/pyramid_hash_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -575,8 +575,7 @@ class CPUPyramidHashOPGradKernel : public framework::OpKernel<T> {
} // namespace paddle

namespace ops = paddle::operators;
namespace plt = paddle::platform;
namespace frm = paddle::framework;

REGISTER_OPERATOR(pyramid_hash,
ops::PyramidHashOP,
ops::PyramidHashOpMaker,
Expand Down
1 change: 0 additions & 1 deletion paddle/fluid/operators/random_crop_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ class RandomCropOpMaker : public framework::OpProtoAndCheckerMaker {
} // namespace paddle

namespace ops = paddle::operators;
namespace f = paddle::framework;
REGISTER_OPERATOR(
random_crop,
ops::RandomCropOp,
Expand Down
1 change: 0 additions & 1 deletion paddle/fluid/operators/random_routing_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ DECLARE_INPLACE_OP_INFERER(RandomRoutingInplaceInferer, {"TopK_Idx", "Out"});
} // namespace paddle

namespace ops = paddle::operators;
namespace plat = paddle::platform;

REGISTER_OPERATOR(
random_routing,
Expand Down
1 change: 0 additions & 1 deletion paddle/fluid/operators/set_value_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,6 @@ DECLARE_INPLACE_OP_INFERER(SetValueOpInplaceInferer, {"Input", "Out"});
} // namespace paddle

namespace ops = paddle::operators;
namespace plat = paddle::platform;

DECLARE_INFER_SHAPE_FUNCTOR(set_value,
SetValueInferShapeFunctor,
Expand Down
7 changes: 0 additions & 7 deletions paddle/fluid/operators/string/faster_tokenizer_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,8 @@ limitations under the License. */
namespace paddle {
namespace operators {

using std::bad_cast;
using std::codecvt_utf8;
using std::endl;
using std::exception;
using std::ifstream;
using std::int64_t;
using std::min;
using std::runtime_error;
using std::shared_ptr;
using std::size_t;
using std::string;
using std::unordered_map;
Expand Down
2 changes: 0 additions & 2 deletions paddle/fluid/operators/sum_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,6 @@ DECLARE_INPLACE_OP_INFERER(SumInplaceInferer, {"X", "Out"});
} // namespace operators
} // namespace paddle

namespace ops = paddle::operators;

namespace ops = paddle::operators;
DECLARE_INFER_SHAPE_FUNCTOR(sum,
AddNInferShapeFunctor,
Expand Down
1 change: 0 additions & 1 deletion paddle/fluid/operators/transfer_layout_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ class TransferLayoutOpProtoMaker : public framework::OpProtoAndCheckerMaker {
} // namespace paddle

namespace ops = paddle::operators;
namespace plat = paddle::platform;
DECLARE_INFER_SHAPE_FUNCTOR(transfer_layout,
TransferLayoutInferShapeFunctor,
PD_INFER_META(phi::TransferLayoutInferMeta));
Expand Down
3 changes: 1 addition & 2 deletions paddle/fluid/operators/var_conv_2d_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -523,8 +523,7 @@ class CPUVarConv2dOPGradKernel : public framework::OpKernel<T> {
} // namespace paddle

namespace ops = paddle::operators;
namespace plt = paddle::platform;
namespace frm = paddle::framework;

REGISTER_OPERATOR(var_conv_2d,
ops::VarConv2dOP,
ops::VarConv2dOpMaker,
Expand Down
1 change: 0 additions & 1 deletion paddle/fluid/pybind/data_set_py.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ limitations under the License. */
#include "paddle/fluid/pybind/data_set_py.h"

namespace py = pybind11;
namespace pd = paddle::framework;

namespace paddle {
namespace pybind {
Expand Down
2 changes: 0 additions & 2 deletions paddle/fluid/pybind/distributed_py.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ limitations under the License. */

#include "paddle/phi/kernels/sync_batch_norm_kernel.h"

namespace py = pybind11;

namespace paddle {
namespace pybind {

Expand Down
2 changes: 0 additions & 2 deletions paddle/fluid/pybind/eager_py_layer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ limitations under the License. */
namespace paddle {
namespace pybind {

namespace py = ::pybind11;

PyTypeObject* p_pylayer_type;
extern PyTypeObject* p_tensor_type;

Expand Down
2 changes: 0 additions & 2 deletions paddle/fluid/pybind/heter_wrapper_py.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ limitations under the License. */
#include "paddle/fluid/framework/fleet/heter_wrapper.h"
#include "paddle/fluid/pybind/heter_wrapper_py.h"

namespace py = pybind11;

namespace paddle {
namespace pybind {
#if defined(PADDLE_WITH_PSLIB) && !defined(PADDLE_WITH_HETERPS)
Expand Down
2 changes: 0 additions & 2 deletions paddle/fluid/pybind/metrics_py.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ limitations under the License. */

#include "paddle/fluid/pybind/metrics_py.h"

namespace py = pybind11;

#if defined(PADDLE_WITH_PSLIB)
namespace paddle {
namespace pybind {
Expand Down
1 change: 0 additions & 1 deletion paddle/fluid/pybind/nccl_wrapper_py.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ limitations under the License. */
#include "paddle/fluid/pybind/nccl_wrapper_py.h"

namespace py = pybind11;
namespace pd = paddle::framework;

namespace paddle {
namespace pybind {
Expand Down
1 change: 0 additions & 1 deletion paddle/fluid/pybind/op_function_common.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
#include "paddle/fluid/pybind/imperative.h"
#include "paddle/phi/common/complex.h"

namespace py = pybind11;
namespace paddle {
namespace pybind {

Expand Down
3 changes: 0 additions & 3 deletions paddle/fluid/pybind/protobuf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@ PyTypeObject *g_blockdesc_pytype = nullptr;
namespace pd = paddle::framework;
namespace jit = paddle::jit;

using paddle::distributed::TensorDistAttr;
using paddle::distributed::auto_parallel::OperatorDistAttr;

template <typename T>
static pybind11::bytes SerializeMessage(
T &self) { // NOLINT due to pybind11 convention.
Expand Down
2 changes: 0 additions & 2 deletions paddle/fluid/pybind/ps_gpu_wrapper_py.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ limitations under the License. */
#include "paddle/fluid/framework/fleet/ps_gpu_wrapper.h"
#include "paddle/fluid/pybind/ps_gpu_wrapper_py.h"

namespace py = pybind11;

namespace paddle {
namespace pybind {
#ifdef PADDLE_WITH_HETERPS
Expand Down
5 changes: 0 additions & 5 deletions paddle/phi/kernels/fusion/onednn/fused_matmul_kernel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,7 @@
#include "paddle/phi/core/kernel_registry.h"
#include "paddle/phi/core/tensor_utils.h"

using dnnl::engine;
using dnnl::inner_product_forward;
using dnnl::memory;
using dnnl::prop_kind;
using dnnl::stream;
using phi::ReshapeToMatrix;

namespace phi {
namespace fusion {
Expand Down
Loading

0 comments on commit 138bdf4

Please sign in to comment.