Skip to content

Commit d1e8328

Browse files
NickGerlemanfacebook-github-bot
authored andcommitted
Add QualifierAlignment to Clang Format Config (#44098)
Summary: Pull Request resolved: #44098 This sets `QualiferAlignment` so that code is automatically formatted to west const. I did a pass at this before, but now that we are on new Clang Format, we can enforce it automatically, and I think a couple more cases not previously changed now are. Changelog: [Internal] Reviewed By: christophpurrer Differential Revision: D56143678 fbshipit-source-id: 8f12b288476ea6019fd7d7a93a39b4fe2e75af14
1 parent d53a2bd commit d1e8328

File tree

55 files changed

+100
-99
lines changed

Some content is hidden

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

55 files changed

+100
-99
lines changed

.clang-format

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ SpacesInSquareBrackets: false
8484
Standard: Cpp11
8585
TabWidth: 8
8686
UseTab: Never
87+
QualifierAlignment: Left
8788
---
8889
Language: ObjC
8990
ColumnLimit: 120

packages/react-native/Libraries/AppDelegate/RCTRootViewFactory.mm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ - (instancetype)initWithConfiguration:(RCTRootViewFactoryConfiguration *)configu
105105
{
106106
if (self = [super init]) {
107107
_configuration = configuration;
108-
_contextContainer = std::make_shared<facebook::react::ContextContainer const>();
109-
_reactNativeConfig = std::make_shared<facebook::react::EmptyReactNativeConfig const>();
108+
_contextContainer = std::make_shared<const facebook::react::ContextContainer>();
109+
_reactNativeConfig = std::make_shared<const facebook::react::EmptyReactNativeConfig>();
110110
_contextContainer->insert("ReactNativeConfig", _reactNativeConfig);
111111
_turboModuleManagerDelegate = turboModuleManagerDelegate;
112112
}

packages/react-native/React/Fabric/Mounting/ComponentViews/Image/RCTImageComponentView.mm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,11 @@ - (void)updateState:(const State::Shared &)state oldState:(const State::Shared &
7474
{
7575
RCTAssert(state, @"`state` must not be null.");
7676
RCTAssert(
77-
std::dynamic_pointer_cast<ImageShadowNode::ConcreteState const>(state),
77+
std::dynamic_pointer_cast<const ImageShadowNode::ConcreteState>(state),
7878
@"`state` must be a pointer to `ImageShadowNode::ConcreteState`.");
7979

80-
auto oldImageState = std::static_pointer_cast<ImageShadowNode::ConcreteState const>(_state);
81-
auto newImageState = std::static_pointer_cast<ImageShadowNode::ConcreteState const>(state);
80+
auto oldImageState = std::static_pointer_cast<const ImageShadowNode::ConcreteState>(_state);
81+
auto newImageState = std::static_pointer_cast<const ImageShadowNode::ConcreteState>(state);
8282

8383
[self _setStateAndResubscribeImageResponseObserver:newImageState];
8484

packages/react-native/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryComponentView.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &
120120
- (void)updateState:(const facebook::react::State::Shared &)state
121121
oldState:(const facebook::react::State::Shared &)oldState
122122
{
123-
_state = std::static_pointer_cast<InputAccessoryShadowNode::ConcreteState const>(state);
123+
_state = std::static_pointer_cast<const InputAccessoryShadowNode::ConcreteState>(state);
124124
CGSize oldScreenSize = RCTCGSizeFromSize(_state->getData().viewportSize);
125125
CGSize viewportSize = RCTViewportSize();
126126
viewportSize.height = std::nan("");

packages/react-native/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.mm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ + (ComponentDescriptorProvider)componentDescriptorProvider
193193

194194
- (void)updateState:(const State::Shared &)state oldState:(const State::Shared &)oldState
195195
{
196-
_state = std::static_pointer_cast<LegacyViewManagerInteropShadowNode::ConcreteState const>(state);
196+
_state = std::static_pointer_cast<const LegacyViewManagerInteropShadowNode::ConcreteState>(state);
197197
}
198198

199199
- (void)finalizeUpdates:(RNComponentViewUpdateMask)updateMask
@@ -217,7 +217,7 @@ - (void)finalizeUpdates:(RNComponentViewUpdateMask)updateMask
217217
if (weakSelf) {
218218
__typeof(self) strongSelf = weakSelf;
219219
const auto &eventEmitter =
220-
static_cast<LegacyViewManagerInteropViewEventEmitter const &>(*strongSelf->_eventEmitter);
220+
static_cast<const LegacyViewManagerInteropViewEventEmitter &>(*strongSelf->_eventEmitter);
221221
eventEmitter.dispatchEvent(eventName, event);
222222
}
223223
};

packages/react-native/React/Fabric/Mounting/ComponentViews/SafeAreaView/RCTSafeAreaViewComponentView.mm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ - (void)_updateStateIfNecessary
6363

6464
auto newData = oldData;
6565
newData.padding = newPadding;
66-
return std::make_shared<SafeAreaViewShadowNode::ConcreteState::Data const>(newData);
66+
return std::make_shared<const SafeAreaViewShadowNode::ConcreteState::Data>(newData);
6767
});
6868
}
6969

@@ -77,7 +77,7 @@ + (ComponentDescriptorProvider)componentDescriptorProvider
7777
- (void)updateState:(const facebook::react::State::Shared &)state
7878
oldState:(const facebook::react::State::Shared &)oldState
7979
{
80-
_state = std::static_pointer_cast<SafeAreaViewShadowNode::ConcreteState const>(state);
80+
_state = std::static_pointer_cast<const SafeAreaViewShadowNode::ConcreteState>(state);
8181
}
8282

8383
- (void)finalizeUpdates:(RNComponentViewUpdateMask)updateMask

packages/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -308,8 +308,8 @@ - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &
308308

309309
- (void)updateState:(const State::Shared &)state oldState:(const State::Shared &)oldState
310310
{
311-
assert(std::dynamic_pointer_cast<ScrollViewShadowNode::ConcreteState const>(state));
312-
_state = std::static_pointer_cast<ScrollViewShadowNode::ConcreteState const>(state);
311+
assert(std::dynamic_pointer_cast<const ScrollViewShadowNode::ConcreteState>(state));
312+
_state = std::static_pointer_cast<const ScrollViewShadowNode::ConcreteState>(state);
313313
auto &data = _state->getData();
314314

315315
auto contentOffset = RCTCGPointFromPoint(data.contentOffset);
@@ -412,7 +412,7 @@ - (void)_updateStateWithContentOffset
412412
_state->updateState([contentOffset](const ScrollViewShadowNode::ConcreteState::Data &data) {
413413
auto newData = data;
414414
newData.contentOffset = contentOffset;
415-
return std::make_shared<ScrollViewShadowNode::ConcreteState::Data const>(newData);
415+
return std::make_shared<const ScrollViewShadowNode::ConcreteState::Data>(newData);
416416
});
417417
}
418418

packages/react-native/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &
105105

106106
- (void)updateState:(const State::Shared &)state oldState:(const State::Shared &)oldState
107107
{
108-
_state = std::static_pointer_cast<ParagraphShadowNode::ConcreteState const>(state);
108+
_state = std::static_pointer_cast<const ParagraphShadowNode::ConcreteState>(state);
109109
[self setNeedsDisplay];
110110
}
111111

packages/react-native/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &
216216

217217
- (void)updateState:(const State::Shared &)state oldState:(const State::Shared &)oldState
218218
{
219-
_state = std::static_pointer_cast<TextInputShadowNode::ConcreteState const>(state);
219+
_state = std::static_pointer_cast<const TextInputShadowNode::ConcreteState>(state);
220220

221221
if (!_state) {
222222
assert(false && "State is `null` for <TextInput> component.");

packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &
195195
RCTAssert(
196196
propsRawPtr &&
197197
([self class] == [RCTViewComponentView class] ||
198-
typeid(*propsRawPtr).hash_code() != typeid(ViewProps const).hash_code()),
198+
typeid(*propsRawPtr).hash_code() != typeid(const ViewProps).hash_code()),
199199
@"`RCTViewComponentView` subclasses (and `%@` particularly) must setup `_props`"
200200
" instance variable with a default value in the constructor.",
201201
NSStringFromClass([self class]));

0 commit comments

Comments
 (0)