Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clang Tidy: +modernize-use-using #3420

Merged
merged 1 commit into from
Jul 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ Checks: >
-modernize-macro-to-enum,
-modernize-return-braced-init-list,
-modernize-use-trailing-return-type,
-modernize-use-using,
performance-*,
readability-*,
-readability-braces-around-statements,
Expand Down
2 changes: 1 addition & 1 deletion Src/Amr/AMReX_Amr.H
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class AmrInSituBridge;
class Amr
: public AmrCore
{
typedef std::multimap< std::pair<int, int>, double > BoundaryPointList;
using BoundaryPointList = std::multimap< std::pair<int, int>, double >;

public:
//! The constructor.
Expand Down
4 changes: 2 additions & 2 deletions Src/Amr/AMReX_AmrLevel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -769,9 +769,9 @@ FillPatchIteratorHelper::Initialize (int boxGrow,
//
// A couple typedefs we'll use in the next code segment.
//
typedef std::map<int,Vector<Vector<Box> > >::value_type IntAABoxMapValType;
using IntAABoxMapValType = std::map<int,Vector<Vector<Box> > >::value_type;

typedef std::map<int,Vector<Vector<Vector<FillBoxId> > > >::value_type IntAAAFBIDMapValType;
using IntAAAFBIDMapValType = std::map<int,Vector<Vector<Vector<FillBoxId> > > >::value_type;

if (m_leveldata.DistributionMap()[i] != MyProc) continue;
//
Expand Down
44 changes: 22 additions & 22 deletions Src/Amr/AMReX_Derive.H
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@ extern "C"
* \param level
* \param grid_no
*/
typedef void (*DeriveFunc)(amrex::Real* data, AMREX_ARLIM_P(dlo), AMREX_ARLIM_P(dhi),
const int* nvar, const amrex::Real* compdat,
AMREX_ARLIM_P(compdat_lo), AMREX_ARLIM_P(compdat_hi),
const int* ncomp,
const int* lo, const int* hi,
const int* domain_lo, const int* domain_hi,
const amrex::Real* delta, const amrex::Real* xlo,
const amrex::Real* time, const amrex::Real* dt,
const int* bcrec,
const int* level, const int* grid_no) ;
using DeriveFunc = void (*)(amrex::Real* data, AMREX_ARLIM_P(dlo), AMREX_ARLIM_P(dhi),
const int* nvar, const amrex::Real* compdat,
AMREX_ARLIM_P(compdat_lo), AMREX_ARLIM_P(compdat_hi),
const int* ncomp,
const int* lo, const int* hi,
const int* domain_lo, const int* domain_hi,
const amrex::Real* delta, const amrex::Real* xlo,
const amrex::Real* time, const amrex::Real* dt,
const int* bcrec,
const int* level, const int* grid_no) ;

/**
* \brief This is dimension agnostic. For example, dlo always has three elements.
Expand All @@ -74,19 +74,19 @@ extern "C"
* \param level
* \param grid_no
*/
typedef void (*DeriveFunc3D)(amrex::Real* data, const int* dlo, const int* dhi, const int* nvar,
const amrex::Real* compdat, const int* clo, const int* chi, const int* ncomp,
const int* lo, const int* hi,
const int* domain_lo, const int* domain_hi,
const amrex::Real* delta, const amrex::Real* xlo,
const amrex::Real* time, const amrex::Real* dt,
const int* bcrec,
const int* level, const int* grid_no) ;
using DeriveFunc3D = void (*)(amrex::Real* data, const int* dlo, const int* dhi, const int* nvar,
const amrex::Real* compdat, const int* clo, const int* chi, const int* ncomp,
const int* lo, const int* hi,
const int* domain_lo, const int* domain_hi,
const amrex::Real* delta, const amrex::Real* xlo,
const amrex::Real* time, const amrex::Real* dt,
const int* bcrec,
const int* level, const int* grid_no) ;
}

typedef std::function<void(const amrex::Box& bx, amrex::FArrayBox& derfab, int dcomp, int ncomp,
const amrex::FArrayBox& datafab, const amrex::Geometry& geomdata,
amrex::Real time, const int* bcrec, int level)> DeriveFuncFab;
using DeriveFuncFab = std::function<void(const amrex::Box& bx, amrex::FArrayBox& derfab, int dcomp, int ncomp,
const amrex::FArrayBox& datafab, const amrex::Geometry& geomdata,
amrex::Real time, const int* bcrec, int level)>;

class DescriptorList;

Expand All @@ -111,7 +111,7 @@ public:
* \brief A pointer to function taking and returning a Box.
*
*/
typedef std::function<Box(const Box&)> DeriveBoxMap;
using DeriveBoxMap = std::function<Box(const Box&)>;

static Box TheSameBox (const Box& box) noexcept;

Expand Down
10 changes: 5 additions & 5 deletions Src/Amr/AMReX_StateDescriptor.H
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@

namespace amrex {

typedef std::function<void(Box const& bx, FArrayBox& data,
const int dcomp, const int numcomp,
Geometry const& geom, const Real time,
const Vector<BCRec>& bcr, const int bcomp,
const int scomp)> BndryFuncFabDefault;
using BndryFuncFabDefault = std::function<void(Box const& bx, FArrayBox& data,
int dcomp, int numcomp,
Geometry const& geom, Real time,
const Vector<BCRec>& bcr, int bcomp,
int scomp)>;

/**
* \brief Attributes of StateData.
Expand Down
38 changes: 19 additions & 19 deletions Src/AmrCore/AMReX_ErrorList.H
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,21 @@ extern "C"
* \param time
* \param level
*/
typedef void (*ErrorFuncDefault)(int* tag, AMREX_ARLIM_P(tlo), AMREX_ARLIM_P(thi),
const int* tagval, const int* clearval,
amrex::Real* data, AMREX_ARLIM_P(data_lo), AMREX_ARLIM_P(data_hi),
const int* lo, const int * hi, const int* nvar,
const int* domain_lo, const int* domain_hi,
const amrex::Real* dx, const amrex::Real* xlo,
const amrex::Real* prob_lo, const amrex::Real* time,
const int* level);

typedef void (*ErrorFunc2Default)(int* tag, AMREX_ARLIM_P(tlo), AMREX_ARLIM_P(thi),
using ErrorFuncDefault = void (*)(int* tag, AMREX_ARLIM_P(tlo), AMREX_ARLIM_P(thi),
const int* tagval, const int* clearval,
amrex::Real* data, AMREX_ARLIM_P(data_lo), AMREX_ARLIM_P(data_hi),
const int* lo, const int * hi, const int* nvar,
const int* domain_lo, const int* domain_hi,
const amrex::Real* dx, const int* level, const amrex::Real* avg);
const amrex::Real* dx, const amrex::Real* xlo,
const amrex::Real* prob_lo, const amrex::Real* time,
const int* level);

using ErrorFunc2Default = void (*)(int* tag, AMREX_ARLIM_P(tlo), AMREX_ARLIM_P(thi),
const int* tagval, const int* clearval,
amrex::Real* data, AMREX_ARLIM_P(data_lo), AMREX_ARLIM_P(data_hi),
const int* lo, const int * hi, const int* nvar,
const int* domain_lo, const int* domain_hi,
const amrex::Real* dx, const int* level, const amrex::Real* avg);


/**
Expand All @@ -81,14 +81,14 @@ extern "C"
* \param time
* \param level
*/
typedef void (*ErrorFunc3DDefault)(int* tag, const int* tlo, const int* thi,
const int* tagval, const int* clearval,
amrex::Real* data, const int* data_lo, const int* data_hi,
const int* lo, const int * hi, const int* nvar,
const int* domain_lo, const int* domain_hi,
const amrex::Real* dx, const amrex::Real* xlo,
const amrex::Real* prob_lo, const amrex::Real* time,
const int* level);
using ErrorFunc3DDefault = void (*)(int* tag, const int* tlo, const int* thi,
const int* tagval, const int* clearval,
amrex::Real* data, const int* data_lo, const int* data_hi,
const int* lo, const int * hi, const int* nvar,
const int* domain_lo, const int* domain_hi,
const amrex::Real* dx, const amrex::Real* xlo,
const amrex::Real* prob_lo, const amrex::Real* time,
const int* level);

}

Expand Down
4 changes: 2 additions & 2 deletions Src/AmrCore/AMReX_TagBox.H
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class TagBox final
public:

//! The type of each tag.
typedef char TagType;
using TagType = char;

//! Possible values for each cell.
enum TagVal { CLEAR=0, BUF, SET };
Expand Down Expand Up @@ -153,7 +153,7 @@ class TagBoxArray
public:

//! The type of each tag.
typedef TagBox::TagType TagType;
using TagType = TagBox::TagType;

/**
* \brief The constructor.
Expand Down
4 changes: 2 additions & 2 deletions Src/Base/AMReX.H
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ namespace amrex
{
class AMReX;

typedef void (*PTR_TO_VOID_FUNC)();
typedef void (*ErrorHandler) (const char* msg);
using PTR_TO_VOID_FUNC = void (*)();
using ErrorHandler = void (*)(const char*);

namespace system
{
Expand Down
2 changes: 1 addition & 1 deletion Src/Base/AMReX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ namespace {
std::streamsize prev_out_precision;
std::streamsize prev_err_precision;
std::new_handler prev_new_handler;
typedef void (*SignalHandler)(int);
using SignalHandler = void (*)(int);
SignalHandler prev_handler_sigsegv = SIG_ERR; // NOLINT(performance-no-int-to-ptr)
SignalHandler prev_handler_sigterm = SIG_ERR; // NOLINT(performance-no-int-to-ptr)
SignalHandler prev_handler_sigint = SIG_ERR; // NOLINT(performance-no-int-to-ptr)
Expand Down
2 changes: 1 addition & 1 deletion Src/Base/AMReX_BLProfiler.H
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ class BLProfiler
static int prevCallStackDepth;

public:
typedef std::pair<Real, int> RIpair;
using RIpair = std::pair<Real, int>;
struct fTTComp {
bool operator()(const RIpair &lhs, const RIpair &rhs) const {
return lhs.first > rhs.first;
Expand Down
2 changes: 1 addition & 1 deletion Src/Base/AMReX_BaseFab.H
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ public:

template <class U> friend class BaseFab;

typedef T value_type;
using value_type = T;

//! Construct an empty BaseFab, which must be resized (see BaseFab::resize) before use.
BaseFab () noexcept = default;
Expand Down
2 changes: 1 addition & 1 deletion Src/Base/AMReX_BoxArray.H
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ struct BARef

mutable IntVect crsn;

typedef std::unordered_map< IntVect, std::vector<int>, IntVect::shift_hasher > HashType;
using HashType = std::unordered_map< IntVect, std::vector<int>, IntVect::shift_hasher > ;
//using HashType = std::map< IntVect,std::vector<int> >;

mutable HashType hash;
Expand Down
3 changes: 2 additions & 1 deletion Src/Base/AMReX_BoxDomain.H
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ class BoxDomain
public:
friend class ClusterList;

typedef BoxList::const_iterator const_iterator;
using const_iterator = BoxList::const_iterator;

//! Construct an empty BoxDomain of IndexType::TheCellType().
BoxDomain ();

Expand Down
4 changes: 2 additions & 2 deletions Src/Base/AMReX_BoxList.H
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ public:

friend class BoxDomain;

typedef Vector<Box>::iterator iterator;
typedef Vector<Box>::const_iterator const_iterator;
using iterator = Vector<Box>::iterator;
using const_iterator = Vector<Box>::const_iterator;

//! Construct an empty BoxList with IndexType::TheCellType().
BoxList ();
Expand Down
2 changes: 1 addition & 1 deletion Src/Base/AMReX_CArena.H
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ protected:
* \brief The type of our freelist and blocklist.
* We use a set sorted from lo to hi memory addresses.
*/
typedef std::set<Node> NL;
using NL = std::set<Node>;

//! The list of blocks allocated via ::operator new().
std::vector<std::pair<void*,std::size_t> > m_alloc;
Expand Down
2 changes: 1 addition & 1 deletion Src/Base/AMReX_DistributionMapping.H
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ private:
static void LeastUsedTeams (Vector<int>& rteam, Vector<Vector<int> >& rworker, int nteams, int nworkers);

//! A useful typedef.
typedef void (DistributionMapping::*PVMF)(const BoxArray &, int);
using PVMF = void (DistributionMapping::*)(const BoxArray &, int);

//! Everyone uses the same Strategy -- defaults to SFC.
static Strategy m_Strategy;
Expand Down
16 changes: 8 additions & 8 deletions Src/Base/AMReX_FACopyDescriptor.H
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,13 @@ FabCopyDescriptor<FAB>::~FabCopyDescriptor ()
template <class FAB>
class FabArrayCopyDescriptor
{
typedef std::multimap<int,FabCopyDescriptor<FAB>*> FCDMap;
using FCDMap = std::multimap<int,FabCopyDescriptor<FAB>*>;

typedef typename FCDMap::value_type FCDMapValueType;
typedef typename FCDMap::iterator FCDMapIter;
typedef typename FCDMap::const_iterator FCDMapConstIter;
using FCDMapValueType = typename FCDMap::value_type;
using FCDMapIter = typename FCDMap::iterator;
using FCDMapConstIter = typename FCDMap::const_iterator;

public:
public:

FabArrayCopyDescriptor () = default;

Expand Down Expand Up @@ -186,9 +186,9 @@ private:
//!
//! Some useful typedefs.
//!
typedef std::vector<FabArrayBase::FabComTag> FabComTagContainer;
using FabComTagContainer = std::vector<FabArrayBase::FabComTag>;

typedef std::vector<FabComTagContainer::const_iterator> FabComTagIterContainer;
using FabComTagIterContainer = std::vector<FabComTagContainer::const_iterator>;
//!
//! The data.
//!
Expand Down Expand Up @@ -438,7 +438,7 @@ FabArrayCopyDescriptor<FAB>::CollectData ()
if (ParallelDescriptor::NProcs() == 1) return;

#ifdef BL_USE_MPI
typedef typename FAB::value_type value_type;
using value_type = typename FAB::value_type;

BL_PROFILE("FabArrayCopyDescriptor::CollectData()");

Expand Down
12 changes: 6 additions & 6 deletions Src/Base/AMReX_FBI.H
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ void
fab_to_fab (Vector<Array4CopyTag<T0, T1> > const& copy_tags, int scomp, int dcomp,
int ncomp, F && f, Vector<Array4Tag<int> > const& masks)
{
typedef Array4MaskCopyTag<T0, T1> TagType;
using TagType = Array4MaskCopyTag<T0, T1>;
Vector<TagType> tags;
const int N = copy_tags.size();
tags.reserve(N);
Expand Down Expand Up @@ -276,7 +276,7 @@ FabArray<FAB>::FB_local_copy_gpu (const FB& TheFB, int scomp, int ncomp)
if (N_locs == 0) return;
bool is_thread_safe = TheFB.m_threadsafe_loc;

typedef Array4CopyTag<value_type> TagType;
using TagType = Array4CopyTag<value_type>;
Vector<TagType> loc_copy_tags;
loc_copy_tags.reserve(N_locs);

Expand Down Expand Up @@ -337,7 +337,7 @@ FabArray<FAB>::CMD_local_setVal_gpu (typename FabArray<FAB>::value_type x,
if (N_locs == 0) return;
bool is_thread_safe = thecmd.m_threadsafe_loc;

typedef Array4BoxTag<value_type> TagType;
using TagType = Array4BoxTag<value_type>;
Vector<TagType> loc_setval_tags;
loc_setval_tags.reserve(N_locs);

Expand Down Expand Up @@ -365,7 +365,7 @@ FabArray<FAB>::CMD_remote_setVal_gpu (typename FabArray<FAB>::value_type x,
auto const& RcvTags = *(thecmd.m_RcvTags);
bool is_thread_safe = thecmd.m_threadsafe_rcv;

typedef Array4BoxTag<value_type> TagType;
using TagType = Array4BoxTag<value_type>;
Vector<TagType> rcv_setval_tags;

for (auto it = RcvTags.begin(); it != RcvTags.end(); ++it) {
Expand Down Expand Up @@ -749,7 +749,7 @@ FabArray<FAB>::pack_send_buffer_gpu (FabArray<FAB> const& src, int scomp, int nc
}
#endif

typedef Array4CopyTag<BUF, value_type> TagType;
using TagType = Array4CopyTag<BUF, value_type>;
Vector<TagType> snd_copy_tags;
for (int j = 0; j < N_snds; ++j)
{
Expand Down Expand Up @@ -812,7 +812,7 @@ FabArray<FAB>::unpack_recv_buffer_gpu (FabArray<FAB>& dst, int dcomp, int ncomp,
}
#endif

typedef Array4CopyTag<value_type, BUF> TagType;
using TagType = Array4CopyTag<value_type, BUF>;
Vector<TagType> recv_copy_tags;
recv_copy_tags.reserve(N_rcvs);

Expand Down
2 changes: 1 addition & 1 deletion Src/Base/AMReX_FEIntegrator.H
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ template<class T>
class FEIntegrator : public IntegratorBase<T>
{
private:
typedef IntegratorBase<T> BaseT;
using BaseT = IntegratorBase<T>;

amrex::Vector<std::unique_ptr<T> > F_nodes;

Expand Down
4 changes: 2 additions & 2 deletions Src/Base/AMReX_FabArray.H
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ class FabArray
public:

struct FABType {
typedef FAB value_type;
using value_type = FAB;
};

/*
Expand Down Expand Up @@ -1301,7 +1301,7 @@ protected:
bool SharedMemory () const noexcept { return shmem.alloc; }

private:
typedef typename std::vector<FAB*>::iterator Iterator;
using Iterator = typename std::vector<FAB*>::iterator;

void AllocFabs (const FabFactory<FAB>& factory, Arena* ar,
const Vector<std::string>& tags);
Expand Down
Loading