Skip to content

Commit

Permalink
Adds spaces after operator overloads
Browse files Browse the repository at this point in the history
  • Loading branch information
ilumsden committed Oct 11, 2024
1 parent 55064cc commit fa551af
Show file tree
Hide file tree
Showing 44 changed files with 98 additions and 97 deletions.
2 changes: 1 addition & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: true
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeParens: Custom
SpaceBeforeParensOptions:
AfterControlStatements: true
AfterForeachMacros: true
Expand Down
14 changes: 7 additions & 7 deletions include/caliper/Annotation.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ class Function

Function(const char* name);

Function(const Function&) = delete;
Function& operator=(const Function&) = delete;
Function(const Function&) = delete;
Function& operator= (const Function&) = delete;

~Function();
};
Expand All @@ -42,8 +42,8 @@ class ScopeAnnotation

explicit ScopeAnnotation(const char* name);

ScopeAnnotation(const ScopeAnnotation&) = delete;
ScopeAnnotation& operator=(const ScopeAnnotation&) = delete;
ScopeAnnotation(const ScopeAnnotation&) = delete;
ScopeAnnotation& operator= (const ScopeAnnotation&) = delete;

~ScopeAnnotation();
};
Expand Down Expand Up @@ -128,7 +128,7 @@ class Annotation

~Annotation();

Annotation& operator=(const Annotation&);
Annotation& operator= (const Annotation&);

/// \brief Scope guard to automatically close an annotation at the end of
/// the C++ scope.
Expand All @@ -151,8 +151,8 @@ class Annotation

Guard(Annotation& a);

Guard(const Guard&) = delete;
Guard& operator=(const Guard&) = delete;
Guard(const Guard&) = delete;
Guard& operator= (const Guard&) = delete;

~Guard();
};
Expand Down
12 changes: 6 additions & 6 deletions include/caliper/CaliFunctional.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ struct SafeAnnotation {

Annotation& getAnnot() { return inner_annot; }

SafeAnnotation& operator=(SafeAnnotation& other)
SafeAnnotation& operator= (SafeAnnotation& other)
{
inner_annot = other.getAnnot();
return *this;
Expand Down Expand Up @@ -208,7 +208,7 @@ struct WrappedFunction {
WrappedFunction(const char* func_name, LB func) : body(func) { name = func_name; }

template <typename... Args>
auto operator()(Args... args) -> typename std::result_of<LB(Args...)>::type
auto operator() (Args... args) -> typename std::result_of<LB(Args...)>::type
{

cali::Annotation::Guard func_annot(wrapper_annotation().begin(name).getAnnot());
Expand All @@ -224,7 +224,7 @@ struct ArgWrappedFunction {
ArgWrappedFunction(const char* func_name, LB func) : body(func) { name = func_name; }

template <typename... Args>
auto operator()(Args... args) -> typename std::enable_if<
auto operator() (Args... args) -> typename std::enable_if<
!std::is_same<typename std::result_of<LB(Args...)>::type, void>::value,
typename std::result_of<LB(Args...)>::type>::type
{
Expand All @@ -242,7 +242,7 @@ struct ArgWrappedFunction {
}

template <typename... Args>
auto operator()(Args... args) -> typename std::enable_if<
auto operator() (Args... args) -> typename std::enable_if<
std::is_same<typename std::result_of<LB(Args...)>::type, void>::value,
typename std::result_of<LB(Args...)>::type>::type
{
Expand Down Expand Up @@ -320,7 +320,7 @@ struct RecordedFunction {
RecordedFunction(const char* func_name, LB func) : body(func) { name = func_name; }

template <typename... Args>
auto operator()(Args... args) -> typename std::enable_if<
auto operator() (Args... args) -> typename std::enable_if<
!std::is_same<typename std::result_of<LB(Args...)>::type, void>::value,
typename std::result_of<LB(Args...)>::type>::type
{
Expand All @@ -339,7 +339,7 @@ struct RecordedFunction {
}

template <typename... Args>
auto operator()(Args... args) -> typename std::enable_if<
auto operator() (Args... args) -> typename std::enable_if<
std::is_same<typename std::result_of<LB(Args...)>::type, void>::value,
typename std::result_of<LB(Args...)>::type>::type
{
Expand Down
18 changes: 9 additions & 9 deletions include/caliper/Caliper.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ class Channel
Channel(const Channel&) = default;
Channel(Channel&&) = default;

Channel& operator=(const Channel&) = default;
Channel& operator=(Channel&&) = default;
Channel& operator= (const Channel&) = default;
Channel& operator= (Channel&&) = default;

~Channel();

Expand Down Expand Up @@ -173,19 +173,19 @@ class Channel

cali_id_t id() const;

operator bool() const { return mP.use_count() > 0; }
operator bool () const { return mP.use_count() > 0; }

friend class Caliper;
friend bool operator==(const Channel&, const Channel&);
friend bool operator!=(const Channel&, const Channel&);
friend bool operator== (const Channel&, const Channel&);
friend bool operator!= (const Channel&, const Channel&);
};

inline bool operator==(const Channel& a, const Channel& b)
inline bool operator== (const Channel& a, const Channel& b)
{
return a.mP == b.mP;
}

inline bool operator!=(const Channel& a, const Channel& b)
inline bool operator!= (const Channel& a, const Channel& b)
{
return a.mP != b.mP;
}
Expand Down Expand Up @@ -693,7 +693,7 @@ class Caliper : public CaliperMetadataAccessInterface

Caliper(const Caliper&) = default;

Caliper& operator=(const Caliper&) = default;
Caliper& operator= (const Caliper&) = default;

/// \brief Check if this is a signal-safe %Caliper instance.
///
Expand All @@ -704,7 +704,7 @@ class Caliper : public CaliperMetadataAccessInterface
bool is_signal() const { return m_is_signal; };

/// \brief Return \a true if this is a valid %Caliper instance.
operator bool() const;
operator bool () const;

/// \brief Construct a Caliper instance object.
///
Expand Down
10 changes: 5 additions & 5 deletions include/caliper/SnapshotRecord.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class SnapshotView

bool empty() const { return m_len == 0; }

const Entry& operator[](std::size_t n) const { return m_data[n]; }
const Entry& operator[] (std::size_t n) const { return m_data[n]; }

Entry get(const Attribute& attr) const
{
Expand Down Expand Up @@ -86,8 +86,8 @@ class SnapshotBuilder
SnapshotBuilder(SnapshotBuilder&&) = default;
SnapshotBuilder(const SnapshotBuilder&) = delete;

SnapshotBuilder& operator=(SnapshotBuilder&&) = default;
SnapshotBuilder& operator=(const SnapshotBuilder&) = delete;
SnapshotBuilder& operator= (SnapshotBuilder&&) = default;
SnapshotBuilder& operator= (const SnapshotBuilder&) = delete;

size_t capacity() const { return m_capacity; }

Expand Down Expand Up @@ -129,8 +129,8 @@ class FixedSizeSnapshotRecord

FixedSizeSnapshotRecord() : m_builder { N, m_data } {}

FixedSizeSnapshotRecord(const FixedSizeSnapshotRecord<N>&) = delete;
FixedSizeSnapshotRecord<N> operator=(const FixedSizeSnapshotRecord<N>&) = delete;
FixedSizeSnapshotRecord(const FixedSizeSnapshotRecord<N>&) = delete;
FixedSizeSnapshotRecord<N> operator= (const FixedSizeSnapshotRecord<N>&) = delete;

SnapshotBuilder& builder() { return m_builder; }

Expand Down
16 changes: 8 additions & 8 deletions include/caliper/common/Attribute.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class Attribute

constexpr Attribute() : m_node(nullptr) {}

operator bool() const { return m_node != nullptr; }
operator bool () const { return m_node != nullptr; }

cali_id_t id() const { return m_node ? m_node->id() : CALI_INV_ID; }

Expand Down Expand Up @@ -80,28 +80,28 @@ class Attribute

Attribute(Node* node) : m_node(node) {}

friend bool operator<(const cali::Attribute& a, const cali::Attribute& b);
friend bool operator==(const cali::Attribute& a, const cali::Attribute& b);
friend bool operator!=(const cali::Attribute& a, const cali::Attribute& b);
friend bool operator< (const cali::Attribute& a, const cali::Attribute& b);
friend bool operator== (const cali::Attribute& a, const cali::Attribute& b);
friend bool operator!= (const cali::Attribute& a, const cali::Attribute& b);
};

inline bool operator<(const cali::Attribute& a, const cali::Attribute& b)
inline bool operator< (const cali::Attribute& a, const cali::Attribute& b)
{
return a.id() < b.id();
}

inline bool operator==(const cali::Attribute& a, const cali::Attribute& b)
inline bool operator== (const cali::Attribute& a, const cali::Attribute& b)
{
// we don't have copies of nodes, so the ptr should be unique
return a.m_node == b.m_node;
}

inline bool operator!=(const cali::Attribute& a, const cali::Attribute& b)
inline bool operator!= (const cali::Attribute& a, const cali::Attribute& b)
{
return a.m_node != b.m_node;
}

std::ostream& operator<<(std::ostream&, const cali::Attribute&);
std::ostream& operator<< (std::ostream&, const cali::Attribute&);

} // namespace cali

Expand Down
6 changes: 3 additions & 3 deletions include/caliper/common/Entry.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,18 +83,18 @@ class Entry

static Entry unpack(const CaliperMetadataAccessInterface& db, const unsigned char* buffer, size_t* inc);

friend bool operator==(const Entry&, const Entry&);
friend bool operator== (const Entry&, const Entry&);
};

inline bool operator==(const Entry& lhs, const Entry& rhs)
inline bool operator== (const Entry& lhs, const Entry& rhs)
{
bool node_eq = lhs.m_node == rhs.m_node || (lhs.m_node && rhs.m_node && lhs.m_node->id() == rhs.m_node->id());
bool is_imm = lhs.is_immediate();

return node_eq && (!is_imm || (is_imm && lhs.m_value == rhs.m_value));
}

inline bool operator!=(const Entry& lhs, const Entry& rhs)
inline bool operator!= (const Entry& lhs, const Entry& rhs)
{
return !(lhs == rhs);
}
Expand Down
2 changes: 1 addition & 1 deletion include/caliper/common/Node.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Node : public util::LockfreeIntrusiveTree<Node>

Node(const Node&) = delete;

Node& operator=(const Node&) = delete;
Node& operator= (const Node&) = delete;

/// \brief Check if the node's attribute and value are equal to
/// \a attr and \a v
Expand Down
2 changes: 1 addition & 1 deletion include/caliper/common/OutputStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class OutputStream

/// \brief Returns \a true if the stream is initialized, otherwise
/// returns \a false
operator bool() const;
operator bool () const;

StreamType type() const;

Expand Down
22 changes: 11 additions & 11 deletions include/caliper/common/Variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class Variant

bool empty() const { return (m_v.type_and_size & CALI_VARIANT_TYPE_MASK) == CALI_TYPE_INV; };

operator bool() const { return !empty(); }
operator bool () const { return !empty(); }

bool has_unmanaged_data() const
{
Expand Down Expand Up @@ -100,7 +100,7 @@ class Variant
return to;
}

Variant& operator+=(const Variant& val);
Variant& operator+= (const Variant& val);

Variant& min(const Variant& val);
Variant& max(const Variant& val);
Expand All @@ -120,32 +120,32 @@ class Variant

// vector<unsigned char> data() const;

friend bool operator==(const Variant& lhs, const Variant& rhs);
friend bool operator!=(const Variant& lhs, const Variant& rhs);
friend bool operator<(const Variant& lhs, const Variant& rhs);
friend bool operator>(const Variant& lhs, const Variant& rhs);
friend bool operator== (const Variant& lhs, const Variant& rhs);
friend bool operator!= (const Variant& lhs, const Variant& rhs);
friend bool operator< (const Variant& lhs, const Variant& rhs);
friend bool operator> (const Variant& lhs, const Variant& rhs);
};

inline bool operator==(const Variant& lhs, const Variant& rhs)
inline bool operator== (const Variant& lhs, const Variant& rhs)
{
return cali_variant_eq(lhs.m_v, rhs.m_v);
}

inline bool operator!=(const Variant& lhs, const Variant& rhs)
inline bool operator!= (const Variant& lhs, const Variant& rhs)
{
return !cali_variant_eq(lhs.m_v, rhs.m_v);
}

inline bool operator<(const Variant& lhs, const Variant& rhs)
inline bool operator< (const Variant& lhs, const Variant& rhs)
{
return (cali_variant_compare(lhs.m_v, rhs.m_v) < 0);
}

inline bool operator>(const Variant& lhs, const Variant& rhs)
inline bool operator> (const Variant& lhs, const Variant& rhs)
{
return (cali_variant_compare(lhs.m_v, rhs.m_v) > 0);
}

std::ostream& operator<<(std::ostream& os, const Variant& v);
std::ostream& operator<< (std::ostream& os, const Variant& v);

} // namespace cali
2 changes: 1 addition & 1 deletion include/caliper/common/callback.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class callback
bool empty() const { return mCb.empty(); }

template <class... Args>
void operator()(Args&&... a)
void operator() (Args&&... a)
{
for (auto& f : mCb)
f(a...);
Expand Down
2 changes: 1 addition & 1 deletion include/caliper/reader/Aggregator.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class Aggregator

void add(CaliperMetadataAccessInterface&, const EntryList&);

void operator()(CaliperMetadataAccessInterface& db, const EntryList& list) { add(db, list); }
void operator() (CaliperMetadataAccessInterface& db, const EntryList& list) { add(db, list); }

void flush(CaliperMetadataAccessInterface&, SnapshotProcessFn push);

Expand Down
2 changes: 1 addition & 1 deletion include/caliper/reader/FlatExclusiveRegionProfile.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class FlatExclusiveRegionProfile
const char* region_attr_name = ""
);

void operator()(CaliperMetadataAccessInterface& db, const std::vector<Entry>& rec);
void operator() (CaliperMetadataAccessInterface& db, const std::vector<Entry>& rec);

/// \brief Return tuple with { { region name -> value } map, sum in given region type, total sum }
std::tuple<std::map<std::string, double>, double, double> result() const;
Expand Down
2 changes: 1 addition & 1 deletion include/caliper/reader/FlatInclusiveRegionProfile.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class FlatInclusiveRegionProfile
const char* region_attr_name = ""
);

void operator()(CaliperMetadataAccessInterface& db, const std::vector<Entry>& rec);
void operator() (CaliperMetadataAccessInterface& db, const std::vector<Entry>& rec);

/// \brief Return tuple with { { region name -> value } map, sum in given region type, total sum }
std::tuple<std::map<std::string, double>, double, double> result() const;
Expand Down
2 changes: 1 addition & 1 deletion include/caliper/reader/FormatProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class FormatProcessor
void flush(CaliperMetadataAccessInterface& db);

/// \brief Make FormatProcessor usable as a SnapshotProcessFn.
void operator()(CaliperMetadataAccessInterface& db, const EntryList& rec) { process_record(db, rec); }
void operator() (CaliperMetadataAccessInterface& db, const EntryList& rec) { process_record(db, rec); }

/// \brief Return all known formatter signatures.
static const QuerySpec::FunctionSignature* formatter_defs();
Expand Down
2 changes: 1 addition & 1 deletion include/caliper/reader/NestedExclusiveRegionProfile.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class NestedExclusiveRegionProfile
const char* region_attr_name = ""
);

void operator()(CaliperMetadataAccessInterface& db, const std::vector<Entry>& rec);
void operator() (CaliperMetadataAccessInterface& db, const std::vector<Entry>& rec);

/// \brief Return tuple with { { region name -> value } map, sum in given region type, total sum }
std::tuple<std::map<std::string, double>, double, double> result() const;
Expand Down
2 changes: 1 addition & 1 deletion include/caliper/reader/NestedInclusiveRegionProfile.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class NestedInclusiveRegionProfile
const char* region_attr_name = ""
);

void operator()(CaliperMetadataAccessInterface& db, const std::vector<Entry>& rec);
void operator() (CaliperMetadataAccessInterface& db, const std::vector<Entry>& rec);

/// \brief Return tuple with { { region name -> value } map, sum in given region type, total sum }
std::tuple<std::map<std::string, double>, double, double> result() const;
Expand Down
Loading

0 comments on commit fa551af

Please sign in to comment.