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

Update to clang-format 19 #2740

Merged
merged 3 commits into from
Sep 17, 2024
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
10 changes: 5 additions & 5 deletions .github/workflows/clang_format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ jobs:
# This LLVM script will add the relevant LLVM PPA: https://apt.llvm.org/
wget https://apt.llvm.org/llvm.sh -O /tmp/llvm.sh
chmod +x /tmp/llvm.sh
sudo /tmp/llvm.sh 18
sudo apt-get install -y clang-format-18
sudo /tmp/llvm.sh 19
sudo apt-get install -y clang-format-19
rm /tmp/llvm.sh
clang-format-18 --version
clang-format-19 --version
if: runner.os == 'Linux'

- name: Run Clang Format
run: |
find . -name "*.h" -o -name "*.c" -o -name "*.cpp" -o -name "*.mm" | xargs clang-format-18 --style=file --fallback-style=none --Werror --dry-run
find cpp -name "*.m" | xargs clang-format-18 --style=file --fallback-style=none --Werror --dry-run
find . -name "*.h" -o -name "*.c" -o -name "*.cpp" -o -name "*.mm" | xargs clang-format-19 --style=file --fallback-style=none --Werror --dry-run
find cpp -name "*.m" | xargs clang-format-19 --style=file --fallback-style=none --Werror --dry-run
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ serverSetNewSessionCallbackExample()
"Hello",
"ssl -h 127.0.0.1 -p 10000",
Ice::SSL::ServerAuthenticationOptions{
.sslNewSessionCallback = [](SSL* ssl, const std::string&) {
.sslNewSessionCallback = [](SSL* ssl, const std::string&)
{
SSL_set_verify(ssl, SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT, 0);
}});
//! [sslNewSessionCallback]
Expand Down
6 changes: 3 additions & 3 deletions cpp/include/Ice/MetricsAdminI.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ namespace IceInternal
using TPtr = std::shared_ptr<MetricsType>;
using MetricsMapTPtr = std::shared_ptr<MetricsMapT>;

typedef IceMX::MetricsMap MetricsType::*SubMapMember;
typedef IceMX::MetricsMap MetricsType::* SubMapMember;

class EntryT;
using EntryTPtr = std::shared_ptr<EntryT>;
Expand Down Expand Up @@ -488,7 +488,7 @@ namespace IceInternal
}

template<class SubMapMetricsType>
void registerSubMap(const std::string& subMap, IceMX::MetricsMap MetricsType::*member)
void registerSubMap(const std::string& subMap, IceMX::MetricsMap MetricsType::* member)
{
_subMaps[subMap] = std::pair<IceMX::MetricsMap MetricsType::*, MetricsMapFactoryPtr>(
member,
Expand Down Expand Up @@ -554,7 +554,7 @@ namespace IceInternal
}

template<class MemberMetricsType, class MetricsType>
void registerSubMap(const std::string& map, const std::string& subMap, IceMX::MetricsMap MetricsType::*member)
void registerSubMap(const std::string& map, const std::string& subMap, IceMX::MetricsMap MetricsType::* member)
{
bool updated;
std::shared_ptr<MetricsMapFactoryT<MetricsType>> factory;
Expand Down
12 changes: 6 additions & 6 deletions cpp/include/Ice/MetricsFunctional.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ namespace IceMX
/// \cond INTERNAL
template<class T, typename Y, typename Func> struct ApplyOnMember
{
ApplyOnMember(Y T::*m, Func f) : func(f), member(m) {}
ApplyOnMember(Y T::* m, Func f) : func(f), member(m) {}

template<typename R> void operator()(const R& v) { func(IceInternal::ReferenceWrapper<R>::get(v)->*member); }

Func func;
Y T::*member;
Y T::* member;
};

template<typename T> struct Decrement
Expand All @@ -71,22 +71,22 @@ namespace IceMX
T value;
};

template<class T, typename Y, typename F> ApplyOnMember<T, Y, F> applyOnMember(Y T::*member, F func)
template<class T, typename Y, typename F> ApplyOnMember<T, Y, F> applyOnMember(Y T::* member, F func)
{
return ApplyOnMember<T, Y, F>(member, func);
}

template<class T, typename Y, typename V> ApplyOnMember<T, Y, Add<V>> add(Y T::*member, V value)
template<class T, typename Y, typename V> ApplyOnMember<T, Y, Add<V>> add(Y T::* member, V value)
{
return applyOnMember(member, Add<V>(value));
}

template<class T, typename Y> ApplyOnMember<T, Y, Increment<Y>> inc(Y T::*member)
template<class T, typename Y> ApplyOnMember<T, Y, Increment<Y>> inc(Y T::* member)
{
return applyOnMember(member, Increment<Y>());
}

template<class T, typename Y> ApplyOnMember<T, Y, Decrement<Y>> dec(Y T::*member)
template<class T, typename Y> ApplyOnMember<T, Y, Decrement<Y>> dec(Y T::* member)
{
return applyOnMember(member, Decrement<Y>());
}
Expand Down
14 changes: 7 additions & 7 deletions cpp/include/Ice/MetricsObserverI.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ namespace IceMX

void setDefault(std::string (Helper::*memberFn)(const std::string&) const) { _default = memberFn; }

template<typename Y> void add(const std::string& name, Y Helper::*member)
template<typename Y> void add(const std::string& name, Y Helper::* member)
{
_attributes.insert(typename std::map<std::string, Resolver*>::value_type(
name,
Expand All @@ -125,7 +125,7 @@ namespace IceMX
}

template<typename I, typename O, typename Y>
void add(const std::string& name, O (Helper::*getFn)() const, Y I::*member)
void add(const std::string& name, O (Helper::*getFn)() const, Y I::* member)
{
_attributes.insert(typename std::map<std::string, Resolver*>::value_type(
name,
Expand Down Expand Up @@ -156,12 +156,12 @@ namespace IceMX
template<typename Y> class HelperMemberResolver : public Resolver
{
public:
HelperMemberResolver(const std::string& name, Y Helper::*member) : Resolver(name), _member(member) {}
HelperMemberResolver(const std::string& name, Y Helper::* member) : Resolver(name), _member(member) {}

virtual std::string operator()(const Helper* r) const { return toString(r->*_member); }

private:
Y Helper::*_member;
Y Helper::* _member;
};

template<typename Y> class HelperMemberFunctionResolver : public Resolver
Expand All @@ -182,7 +182,7 @@ namespace IceMX
template<typename I, typename O, typename Y> class MemberResolver : public Resolver
{
public:
MemberResolver(const std::string& name, O (Helper::*getFn)() const, Y I::*member)
MemberResolver(const std::string& name, O (Helper::*getFn)() const, Y I::* member)
: Resolver(name),
_getFn(getFn),
_member(member)
Expand All @@ -205,7 +205,7 @@ namespace IceMX

private:
O (Helper::*_getFn)() const;
Y I::*_member;
Y I::* _member;
};

template<typename I, typename O, typename Y> class MemberFunctionResolver : public Resolver
Expand Down Expand Up @@ -521,7 +521,7 @@ namespace IceMX
}

template<typename SubMapMetricsType>
void registerSubMap(const std::string& subMap, MetricsMap MetricsType::*member)
void registerSubMap(const std::string& subMap, MetricsMap MetricsType::* member)
{
assert(_metrics);
_metrics->registerSubMap<SubMapMetricsType>(_name, subMap, member);
Expand Down
3 changes: 2 additions & 1 deletion cpp/src/Ice/ConnectionI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1467,7 +1467,8 @@ Ice::ConnectionI::message(ThreadPoolCurrent& current)
connectionStartCompleted = std::move(connectionStartCompleted),
sentCBs = std::move(sentCBs),
messageUpcall = std::move(messageUpcall),
stream]() {
stream]()
{
self->upcall(
std::move(connectionStartCompleted),
std::move(sentCBs),
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/Ice/InstrumentationI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ using namespace IceMX;

namespace
{
int ThreadMetrics::*getThreadStateMetric(ThreadState s)
int ThreadMetrics::* getThreadStateMetric(ThreadState s)
{
switch (s)
{
Expand Down
44 changes: 11 additions & 33 deletions cpp/src/Ice/OutputUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,10 @@ namespace IceInternal
bool _separator;
};

class ICE_API NextLine
{
};
class ICE_API NextLine{};
extern ICE_API NextLine nl;

class ICE_API Separator
{
};
class ICE_API Separator{};
extern ICE_API Separator sp;

// ----------------------------------------------------------------------
Expand Down Expand Up @@ -136,9 +132,7 @@ namespace IceInternal
return o;
}

class ICE_API StartBlock
{
};
class ICE_API StartBlock{};
extern ICE_API StartBlock sb;

template<> inline Output& operator<<(Output& o, const StartBlock&)
Expand All @@ -147,9 +141,7 @@ namespace IceInternal
return o;
}

class ICE_API EndBlock
{
};
class ICE_API EndBlock{};
extern ICE_API EndBlock eb;

template<> inline Output& operator<<(Output& o, const EndBlock&)
Expand All @@ -158,9 +150,7 @@ namespace IceInternal
return o;
}

class ICE_API StartPar
{
};
class ICE_API StartPar{};
extern ICE_API StartPar spar;

template<> inline Output& operator<<(Output& o, const StartPar&)
Expand All @@ -169,9 +159,7 @@ namespace IceInternal
return o;
}

class ICE_API EndPar
{
};
class ICE_API EndPar{};
extern ICE_API EndPar epar;

template<> inline Output& operator<<(Output& o, const EndPar&)
Expand All @@ -180,9 +168,7 @@ namespace IceInternal
return o;
}

class ICE_API StartAbrk
{
};
class ICE_API StartAbrk{};
extern ICE_API StartAbrk sabrk;

template<> inline Output& operator<<(Output& o, const StartAbrk&)
Expand All @@ -191,9 +177,7 @@ namespace IceInternal
return o;
}

class ICE_API EndAbrk
{
};
class ICE_API EndAbrk{};
extern ICE_API EndAbrk eabrk;

template<> inline Output& operator<<(Output& o, const EndAbrk&)
Expand Down Expand Up @@ -259,9 +243,7 @@ namespace IceInternal
return o;
}

class ICE_API EndElement
{
};
class ICE_API EndElement{};
extern ICE_API EndElement ee;

template<> inline XMLOutput& operator<<(XMLOutput& o, const EndElement&)
Expand Down Expand Up @@ -310,14 +292,10 @@ namespace IceInternal
return o;
}

class ICE_API StartEscapes
{
};
class ICE_API StartEscapes{};
extern ICE_API StartEscapes startEscapes;

class ICE_API EndEscapes
{
};
class ICE_API EndEscapes{};
extern ICE_API EndEscapes endEscapes;

template<> inline XMLOutput& operator<<(XMLOutput& o, const StartEscapes&)
Expand Down
3 changes: 1 addition & 2 deletions cpp/test/ios/controller/Classes/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

#import "AppDelegate.h"

@interface
AppDelegate ()
@interface AppDelegate ()

@end

Expand Down
3 changes: 1 addition & 2 deletions swift/src/IceImpl/include/Communicator.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ ICEIMPL_API @interface ICECommunicator : ICELocalObject

#ifdef __cplusplus

@interface
ICECommunicator ()
@interface ICECommunicator ()
@property(nonatomic, readonly) std::shared_ptr<Ice::Communicator> communicator;
@end

Expand Down
3 changes: 1 addition & 2 deletions swift/src/IceImpl/include/Connection.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,7 @@ ICEIMPL_API @protocol ICEConnectionInfoFactory

id createConnectionInfo(std::shared_ptr<Ice::ConnectionInfo>);

@interface
ICEConnection ()
@interface ICEConnection ()
@property(nonatomic, readonly) std::shared_ptr<Ice::Connection> connection;
@end

Expand Down
6 changes: 2 additions & 4 deletions swift/src/IceImpl/include/Endpoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,12 @@ ICEIMPL_API @protocol ICEEndpointInfoFactory

#ifdef __cplusplus

@interface
ICEEndpoint ()
@interface ICEEndpoint ()
@property(nonatomic, readonly) std::shared_ptr<Ice::Endpoint> endpoint;
+ (nullable ICEEndpointInfo*)createEndpointInfo:(std::shared_ptr<Ice::EndpointInfo>)infoPtr NS_RETURNS_RETAINED;
@end

@interface
ICEEndpointInfo ()
@interface ICEEndpointInfo ()
@property(nonatomic, readonly) std::shared_ptr<Ice::EndpointInfo> info;
@end

Expand Down
3 changes: 1 addition & 2 deletions swift/src/IceImpl/include/ImplicitContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ ICEIMPL_API @interface ICEImplicitContext : ICELocalObject

#ifdef __cplusplus

@interface
ICEImplicitContext ()
@interface ICEImplicitContext ()
@property(nonatomic, readonly) std::shared_ptr<Ice::ImplicitContext> implicitContext;
@end

Expand Down
3 changes: 1 addition & 2 deletions swift/src/IceImpl/include/LocalObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ ICEIMPL_API @interface ICELocalObject : NSObject

#ifdef __cplusplus

@interface
ICELocalObject ()
@interface ICELocalObject ()
@property(nonatomic, readonly) std::shared_ptr<void> cppObject;
+ (nullable instancetype)getHandle:(std::shared_ptr<void>)cppObject NS_RETURNS_RETAINED;
@end
Expand Down
3 changes: 1 addition & 2 deletions swift/src/IceImpl/include/Logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ ICEIMPL_API @interface ICELogger : ICELocalObject<ICELoggerProtocol>

#ifdef __cplusplus

@interface
ICELogger ()
@interface ICELogger ()
@property(nonatomic, readonly) std::shared_ptr<Ice::Logger> logger;
@end

Expand Down
3 changes: 1 addition & 2 deletions swift/src/IceImpl/include/ObjectAdapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ ICEIMPL_API @interface ICEObjectAdapter : ICELocalObject

#ifdef __cplusplus

@interface
ICEObjectAdapter ()
@interface ICEObjectAdapter ()
@property(nonatomic, readonly) std::shared_ptr<Ice::ObjectAdapter> objectAdapter;
@end

Expand Down
3 changes: 1 addition & 2 deletions swift/src/IceImpl/include/ObjectPrx.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,7 @@ ICEIMPL_API @interface ICEObjectPrx : NSObject

#ifdef __cplusplus

@interface
ICEObjectPrx ()
@interface ICEObjectPrx ()
// prx is always set; we just need a field with a default constructor.
@property(nonatomic, readonly) std::optional<Ice::ObjectPrx> prx;
- (nonnull instancetype)initWithCppObjectPrx:(const Ice::ObjectPrx&)prx;
Expand Down
3 changes: 1 addition & 2 deletions swift/src/IceImpl/include/Process.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ ICEIMPL_API @interface ICEProcess : ICELocalObject

#ifdef __cplusplus

@interface
ICEProcess ()
@interface ICEProcess ()
@property(nonatomic, readonly) std::shared_ptr<Ice::Process> process;
@end

Expand Down
Loading
Loading