Skip to content

Commit 415d41f

Browse files
committed
Rerun clang-formatter-7
1 parent 1a4c8df commit 415d41f

File tree

91 files changed

+585
-558
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+585
-558
lines changed

include/grpcpp/impl/codegen/server_context_impl.h

+6-6
Original file line numberDiff line numberDiff line change
@@ -513,9 +513,6 @@ class ServerContext : public ServerContextBase {
513513

514514
using ServerContextBase::AddInitialMetadata;
515515
using ServerContextBase::AddTrailingMetadata;
516-
using ServerContextBase::IsCancelled;
517-
using ServerContextBase::SetLoadReportingCosts;
518-
using ServerContextBase::TryCancel;
519516
using ServerContextBase::auth_context;
520517
using ServerContextBase::c_call;
521518
using ServerContextBase::census_context;
@@ -524,10 +521,13 @@ class ServerContext : public ServerContextBase {
524521
using ServerContextBase::compression_level;
525522
using ServerContextBase::compression_level_set;
526523
using ServerContextBase::deadline;
524+
using ServerContextBase::IsCancelled;
527525
using ServerContextBase::peer;
528526
using ServerContextBase::raw_deadline;
529527
using ServerContextBase::set_compression_algorithm;
530528
using ServerContextBase::set_compression_level;
529+
using ServerContextBase::SetLoadReportingCosts;
530+
using ServerContextBase::TryCancel;
531531

532532
// Sync/CQ-based Async ServerContext only
533533
using ServerContextBase::AsyncNotifyWhenDone;
@@ -555,9 +555,6 @@ class CallbackServerContext : public ServerContextBase {
555555

556556
using ServerContextBase::AddInitialMetadata;
557557
using ServerContextBase::AddTrailingMetadata;
558-
using ServerContextBase::IsCancelled;
559-
using ServerContextBase::SetLoadReportingCosts;
560-
using ServerContextBase::TryCancel;
561558
using ServerContextBase::auth_context;
562559
using ServerContextBase::c_call;
563560
using ServerContextBase::census_context;
@@ -566,10 +563,13 @@ class CallbackServerContext : public ServerContextBase {
566563
using ServerContextBase::compression_level;
567564
using ServerContextBase::compression_level_set;
568565
using ServerContextBase::deadline;
566+
using ServerContextBase::IsCancelled;
569567
using ServerContextBase::peer;
570568
using ServerContextBase::raw_deadline;
571569
using ServerContextBase::set_compression_algorithm;
572570
using ServerContextBase::set_compression_level;
571+
using ServerContextBase::SetLoadReportingCosts;
572+
using ServerContextBase::TryCancel;
573573

574574
// CallbackServerContext only
575575
using ServerContextBase::DefaultReactor;

include/grpcpp/server_posix_impl.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@ void AddInsecureChannelFromFd(grpc::Server* server, int fd);
3737

3838
#endif // GPR_SUPPORT_CHANNELS_FROM_FD
3939

40-
} // namespace grpc
40+
} // namespace grpc_impl
4141

4242
#endif // GRPCPP_SERVER_POSIX_IMPL_H

src/compiler/csharp_generator.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ using grpc::protobuf::ServiceDescriptor;
3535
using grpc::protobuf::io::Printer;
3636
using grpc::protobuf::io::StringOutputStream;
3737
using grpc_generator::GetMethodType;
38+
using grpc_generator::MethodType;
3839
using grpc_generator::METHODTYPE_BIDI_STREAMING;
3940
using grpc_generator::METHODTYPE_CLIENT_STREAMING;
4041
using grpc_generator::METHODTYPE_NO_STREAMING;
4142
using grpc_generator::METHODTYPE_SERVER_STREAMING;
42-
using grpc_generator::MethodType;
4343
using grpc_generator::StringReplace;
4444
using std::map;
4545
using std::vector;

src/compiler/objective_c_generator.cc

-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828

2929
using ::google::protobuf::compiler::objectivec::ClassName;
3030
using ::grpc::protobuf::FileDescriptor;
31-
using ::grpc::protobuf::FileDescriptor;
3231
using ::grpc::protobuf::MethodDescriptor;
3332
using ::grpc::protobuf::ServiceDescriptor;
3433
using ::grpc::protobuf::io::Printer;

src/compiler/objective_c_generator.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,9 @@ struct Parameters {
2828
bool no_v1_compatibility;
2929
};
3030

31-
using ::grpc::protobuf::FileDescriptor;
31+
using ::grpc::string;
3232
using ::grpc::protobuf::FileDescriptor;
3333
using ::grpc::protobuf::ServiceDescriptor;
34-
using ::grpc::string;
3534

3635
// Returns forward declaration of classes in the generated header file.
3736
string GetAllMessageClasses(const FileDescriptor* file);

src/compiler/objective_c_generator_helpers.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@
2727

2828
namespace grpc_objective_c_generator {
2929

30+
using ::grpc::string;
3031
using ::grpc::protobuf::FileDescriptor;
3132
using ::grpc::protobuf::ServiceDescriptor;
32-
using ::grpc::string;
3333

3434
inline string MessageHeaderName(const FileDescriptor* file) {
3535
return google::protobuf::compiler::objectivec::FilePath(file) + ".pbobjc.h";

src/core/ext/filters/client_channel/xds/xds_client_stats.cc

+6-7
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,12 @@ uint64_t GetAndResetCounter(Atomic<uint64_t>* from) {
8989

9090
XdsClusterLocalityStats::Snapshot
9191
XdsClusterLocalityStats::GetSnapshotAndReset() {
92-
Snapshot snapshot = {
93-
GetAndResetCounter(&total_successful_requests_),
94-
// Don't reset total_requests_in_progress because it's not
95-
// related to a single reporting interval.
96-
total_requests_in_progress_.Load(MemoryOrder::RELAXED),
97-
GetAndResetCounter(&total_error_requests_),
98-
GetAndResetCounter(&total_issued_requests_)};
92+
Snapshot snapshot = {GetAndResetCounter(&total_successful_requests_),
93+
// Don't reset total_requests_in_progress because it's
94+
// not related to a single reporting interval.
95+
total_requests_in_progress_.Load(MemoryOrder::RELAXED),
96+
GetAndResetCounter(&total_error_requests_),
97+
GetAndResetCounter(&total_issued_requests_)};
9998
MutexLock lock(&backend_metrics_mu_);
10099
snapshot.backend_metrics = std::move(backend_metrics_);
101100
return snapshot;

src/core/lib/gpr/time_posix.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ static gpr_timespec now_impl(gpr_clock_type clock_type) {
8282
}
8383
}
8484
#else
85-
/* For some reason Apple's OSes haven't implemented clock_gettime. */
85+
/* For some reason Apple's OSes haven't implemented clock_gettime. */
8686

8787
#include <mach/mach.h>
8888
#include <mach/mach_time.h>

src/core/lib/gprpp/fork.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ class ThreadState {
164164
int count_;
165165
};
166166

167-
} // namespace
167+
} // namespace internal
168168

169169
void Fork::GlobalInit() {
170170
if (!override_enabled_) {

src/core/lib/iomgr/ev_epoll1_linux.cc

+2-3
Original file line numberDiff line numberDiff line change
@@ -1116,9 +1116,8 @@ static grpc_error* pollset_kick(grpc_pollset* pollset,
11161116
}
11171117
SET_KICK_STATE(next_worker, KICKED);
11181118
goto done;
1119-
} else if (root_worker ==
1120-
next_worker && // only try and wake up a poller if
1121-
// there is no next worker
1119+
} else if (root_worker == next_worker && // only try and wake up a poller
1120+
// if there is no next worker
11221121
root_worker == (grpc_pollset_worker*)gpr_atm_no_barrier_load(
11231122
&g_active_poller)) {
11241123
GRPC_STATS_INC_POLLSET_KICK_WAKEUP_FD();

src/core/lib/iomgr/ev_poll_posix.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -307,9 +307,9 @@ static void fork_fd_list_add_wakeup_fd(grpc_cached_wakeup_fd* fd) {
307307
}
308308
}
309309

310-
/*******************************************************************************
311-
* fd_posix.c
312-
*/
310+
/*******************************************************************************
311+
* fd_posix.c
312+
*/
313313

314314
#ifndef NDEBUG
315315
#define REF_BY(fd, n, reason) ref_by(fd, n, reason, __FILE__, __LINE__)

src/core/lib/transport/metadata.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -256,9 +256,9 @@ void grpc_mdctx_global_shutdown() {
256256
abort();
257257
}
258258
}
259-
// For ASAN builds, we don't want to crash here, because that will
260-
// prevent ASAN from providing leak detection information, which is
261-
// far more useful than this simple assertion.
259+
// For ASAN builds, we don't want to crash here, because that will
260+
// prevent ASAN from providing leak detection information, which is
261+
// far more useful than this simple assertion.
262262
#ifndef GRPC_ASAN_ENABLED
263263
GPR_DEBUG_ASSERT(shard->count == 0);
264264
#endif

src/core/lib/transport/static_metadata.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ constexpr uint64_t kGrpcStaticMetadataInitCanary = 0xCAFEF00DC0FFEE11L;
4646
uint64_t StaticMetadataInitCanary();
4747
#endif
4848
extern const StaticMetadataSlice* g_static_metadata_slice_table;
49-
}
49+
} // namespace grpc_core
5050
inline const grpc_core::StaticMetadataSlice* grpc_static_slice_table() {
5151
GPR_DEBUG_ASSERT(grpc_core::StaticMetadataInitCanary() ==
5252
grpc_core::kGrpcStaticMetadataInitCanary);

src/objective-c/GRPCClient/GRPCCall+ChannelArg.h

+3-4
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,9 @@
2727

2828
+ (void)setUserAgentPrefix:(nonnull NSString *)userAgentPrefix forHost:(nonnull NSString *)host;
2929
+ (void)setResponseSizeLimit:(NSUInteger)limit forHost:(nonnull NSString *)host;
30-
+ (void)closeOpenConnections DEPRECATED_MSG_ATTRIBUTE(
31-
"The API for this feature is experimental, "
32-
"and might be removed or modified at any "
33-
"time.");
30+
+ (void)closeOpenConnections DEPRECATED_MSG_ATTRIBUTE("The API for this feature is experimental, "
31+
"and might be removed or modified at any "
32+
"time.");
3433
+ (void)setDefaultCompressMethod:(GRPCCompressAlgorithm)algorithm forhost:(nonnull NSString *)host;
3534
+ (void)setKeepaliveWithInterval:(int)interval
3635
timeout:(int)timeout

src/objective-c/GRPCClient/GRPCCall+GID.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@
2424
/**
2525
* Extend GIDSignIn class to comply GRPCAuthorizationProtocol
2626
*/
27-
@interface GIDSignIn (GRPC)<GRPCAuthorizationProtocol>
27+
@interface GIDSignIn (GRPC) <GRPCAuthorizationProtocol>
2828
- (void)getTokenWithHandler:(void (^)(NSString *token))hander;
2929
@end

src/objective-c/GRPCClient/GRPCCall+Interceptor.m

+4-4
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ + (void)registerGlobalInterceptor:(id<GRPCInterceptorFactory>)interceptorFactory
3535
[globalInterceptorLock lock];
3636
if (globalInterceptorFactory != nil) {
3737
[globalInterceptorLock unlock];
38-
[NSException raise:NSInternalInconsistencyException
39-
format:
40-
@"Global interceptor is already registered. Only one global interceptor can be "
41-
@"registered in a process."];
38+
[NSException
39+
raise:NSInternalInconsistencyException
40+
format:@"Global interceptor is already registered. Only one global interceptor can be "
41+
@"registered in a process."];
4242
return;
4343
}
4444

src/objective-c/GRPCClient/GRPCCall+Tests.m

+3-2
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,9 @@ + (void)useTestCertsPath:(NSString *)certsPath
3737
[NSException raise:NSInvalidArgumentException format:@"testname must be provided."];
3838
}
3939
NSError *error = nil;
40-
NSString *certs =
41-
[NSString stringWithContentsOfFile:certsPath encoding:NSUTF8StringEncoding error:&error];
40+
NSString *certs = [NSString stringWithContentsOfFile:certsPath
41+
encoding:NSUTF8StringEncoding
42+
error:&error];
4243
if (error != nil) {
4344
[NSException raise:[error localizedDescription] format:@"failed to load certs"];
4445
}

src/objective-c/GRPCClient/GRPCCall.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
NS_ASSUME_NONNULL_BEGIN
4848

4949
/** An object can implement this protocol to receive responses from server from a call. */
50-
@protocol GRPCResponseHandler<NSObject, GRPCDispatchable>
50+
@protocol GRPCResponseHandler <NSObject, GRPCDispatchable>
5151

5252
@optional
5353

@@ -99,11 +99,11 @@ NS_ASSUME_NONNULL_BEGIN
9999
* HTTP request parameters. If Protobuf is used, these parameters are automatically generated by
100100
* Protobuf. If directly using the GRPCCall2 class, users should specify these parameters manually.
101101
*/
102-
@interface GRPCRequestOptions : NSObject<NSCopying>
102+
@interface GRPCRequestOptions : NSObject <NSCopying>
103103

104104
- (instancetype)init NS_UNAVAILABLE;
105105

106-
+ (instancetype) new NS_UNAVAILABLE;
106+
+ (instancetype)new NS_UNAVAILABLE;
107107

108108
/** Initialize with all properties. */
109109
- (instancetype)initWithHost:(NSString *)host
@@ -131,7 +131,7 @@ NS_ASSUME_NONNULL_BEGIN
131131

132132
- (instancetype)init NS_UNAVAILABLE;
133133

134-
+ (instancetype) new NS_UNAVAILABLE;
134+
+ (instancetype)new NS_UNAVAILABLE;
135135

136136
/**
137137
* Designated initializer for a call.

src/objective-c/GRPCClient/GRPCCall.m

+7-5
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
* dispatch queue of a user provided response handler. It removes the requirement of having to use
3636
* serial dispatch queue in the user provided response handler.
3737
*/
38-
@interface GRPCResponseDispatcher : NSObject<GRPCResponseHandler>
38+
@interface GRPCResponseDispatcher : NSObject <GRPCResponseHandler>
3939

4040
- (nullable instancetype)initWithResponseHandler:(id<GRPCResponseHandler>)responseHandler;
4141

@@ -117,8 +117,9 @@ - (instancetype)initWithHost:(NSString *)host path:(NSString *)path safety:(GRPC
117117
}
118118

119119
- (id)copyWithZone:(NSZone *)zone {
120-
GRPCRequestOptions *request =
121-
[[GRPCRequestOptions alloc] initWithHost:_host path:_path safety:_safety];
120+
GRPCRequestOptions *request = [[GRPCRequestOptions alloc] initWithHost:_host
121+
path:_path
122+
safety:_safety];
122123

123124
return request;
124125
}
@@ -221,8 +222,9 @@ - (instancetype)initWithRequestOptions:(GRPCRequestOptions *)requestOptions
221222

222223
- (instancetype)initWithRequestOptions:(GRPCRequestOptions *)requestOptions
223224
responseHandler:(id<GRPCResponseHandler>)responseHandler {
224-
return
225-
[self initWithRequestOptions:requestOptions responseHandler:responseHandler callOptions:nil];
225+
return [self initWithRequestOptions:requestOptions
226+
responseHandler:responseHandler
227+
callOptions:nil];
226228
}
227229

228230
- (void)start {

src/objective-c/GRPCClient/GRPCCallLegacy.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@
112112

113113
/** This protocol is kept for backwards compatibility with existing code. */
114114
DEPRECATED_MSG_ATTRIBUTE("Use NSDictionary or NSMutableDictionary instead.")
115-
@protocol GRPCRequestHeaders<NSObject>
115+
@protocol GRPCRequestHeaders <NSObject>
116116
@property(nonatomic, readonly) NSUInteger count;
117117

118118
- (id)objectForKeyedSubscript:(id)key;
@@ -125,7 +125,7 @@ DEPRECATED_MSG_ATTRIBUTE("Use NSDictionary or NSMutableDictionary instead.")
125125
#pragma clang diagnostic push
126126
#pragma clang diagnostic ignored "-Wdeprecated"
127127
/** This is only needed for backwards-compatibility. */
128-
@interface NSMutableDictionary (GRPCRequestHeaders)<GRPCRequestHeaders>
128+
@interface NSMutableDictionary (GRPCRequestHeaders) <GRPCRequestHeaders>
129129
@end
130130
#pragma clang diagnostic pop
131131
#pragma clang diagnostic pop

src/objective-c/GRPCClient/GRPCCallLegacy.m

+23-22
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
static NSString *const kAuthorizationHeader = @"authorization";
4747
static NSString *const kBearerPrefix = @"Bearer ";
4848

49-
@interface GRPCCall ()<GRXWriteable>
49+
@interface GRPCCall () <GRXWriteable>
5050
// Make them read-write.
5151
@property(atomic, strong) NSDictionary *responseHeaders;
5252
@property(atomic, strong) NSDictionary *responseTrailers;
@@ -429,8 +429,8 @@ - (void)writeMessage:(NSData *)message withErrorHandler:(void (^)(void))errorHan
429429
}
430430
}
431431
};
432-
GRPCOpSendMessage *op =
433-
[[GRPCOpSendMessage alloc] initWithMessage:message handler:resumingHandler];
432+
GRPCOpSendMessage *op = [[GRPCOpSendMessage alloc] initWithMessage:message
433+
handler:resumingHandler];
434434
if (!_unaryCall) {
435435
[_wrappedCall startBatchWithOperations:@[ op ] errorHandler:errorHandler];
436436
} else {
@@ -501,22 +501,23 @@ - (void)invokeCallWithHeadersHandler:(void (^)(NSDictionary *))headersHandler
501501

502502
- (void)invokeCall {
503503
__weak GRPCCall *weakSelf = self;
504-
[self invokeCallWithHeadersHandler:^(NSDictionary *headers) {
505-
// Response headers received.
506-
__strong GRPCCall *strongSelf = weakSelf;
507-
if (strongSelf) {
508-
@synchronized(strongSelf) {
509-
// it is ok to set nil because headers are only received once
510-
strongSelf.responseHeaders = nil;
511-
// copy the header so that the GRPCOpRecvMetadata object may be dealloc'ed
512-
NSDictionary *copiedHeaders =
513-
[[NSDictionary alloc] initWithDictionary:headers copyItems:YES];
514-
strongSelf.responseHeaders = copiedHeaders;
515-
strongSelf->_pendingCoreRead = NO;
516-
[strongSelf maybeStartNextRead];
504+
[self
505+
invokeCallWithHeadersHandler:^(NSDictionary *headers) {
506+
// Response headers received.
507+
__strong GRPCCall *strongSelf = weakSelf;
508+
if (strongSelf) {
509+
@synchronized(strongSelf) {
510+
// it is ok to set nil because headers are only received once
511+
strongSelf.responseHeaders = nil;
512+
// copy the header so that the GRPCOpRecvMetadata object may be dealloc'ed
513+
NSDictionary *copiedHeaders = [[NSDictionary alloc] initWithDictionary:headers
514+
copyItems:YES];
515+
strongSelf.responseHeaders = copiedHeaders;
516+
strongSelf->_pendingCoreRead = NO;
517+
[strongSelf maybeStartNextRead];
518+
}
519+
}
517520
}
518-
}
519-
}
520521
completionHandler:^(NSError *error, NSDictionary *trailers) {
521522
__strong GRPCCall *strongSelf = weakSelf;
522523
if (strongSelf) {
@@ -548,11 +549,11 @@ - (void)startCallWithWriteable:(id<GRXWriteable>)writeable {
548549
return;
549550
}
550551

551-
_responseWriteable =
552-
[[GRXConcurrentWriteable alloc] initWithWriteable:writeable dispatchQueue:_responseQueue];
552+
_responseWriteable = [[GRXConcurrentWriteable alloc] initWithWriteable:writeable
553+
dispatchQueue:_responseQueue];
553554

554-
GRPCPooledChannel *channel =
555-
[[GRPCChannelPool sharedInstance] channelWithHost:_host callOptions:_callOptions];
555+
GRPCPooledChannel *channel = [[GRPCChannelPool sharedInstance] channelWithHost:_host
556+
callOptions:_callOptions];
556557
_wrappedCall = [channel wrappedCallWithPath:_path
557558
completionQueue:[GRPCCompletionQueue completionQueue]
558559
callOptions:_callOptions];

0 commit comments

Comments
 (0)