Consistent QualifierAlignment (for real this time I swear) (#39217)

Summary:
(reland of D48761722)

Pull Request resolved: https://github.com/facebook/react-native/pull/39217

React Native uses an inconsistent mix of "west const" and "east const". E.g. `const auto &` in 74 files, but `auto const &` in 60. Sometimes they are mixed from one line to the next:  {F1079102436}

Clang format 14 adds a QualifierAlignment option, but fbsource is still on 12, so we cannot use it in our config until the [world is updated]()https://fb.workplace.com/groups/toolchain.fndn/posts/24006558685624673/?comment_id=24009214565359085&reply_comment_id=24009455088668366. This diff just runs a local version of Clang format locally first to fix QualifierAlignment, then reformats with the fbsource version, to fix any other output differences unrelated to that. This will not continually enforce a style, but will make the world more consistent, and hopefully encourage a consistent style until we can set it.

West const seems more popular in `//xplat` so I just picked left alignment somewhat arbitrarily, but we could also maybe take a poll on this.

Changelog: [Internal]

bypass-github-export-checks

Reviewed By: shwanton

Differential Revision: D48852450

fbshipit-source-id: 1789aa0db43948169f482188cb8b5e8f0f0246b8
This commit is contained in:
Nick Gerleman authored and Facebook GitHub Bot committed 2023-08-30 19:56:13 -07:00
1 parent 6d05aa54bf
commit a966291611
395 files changed
+2370 -2371

No files matched your search

@@ -25,7 +25,7 @@ std::string DebugStringConvertible::getDebugChildrenDescription(
auto trailing = options.format ? std::string{"\n"} : std::string{""};
std::string childrenString;
for (auto const &child : getDebugChildren()) {
for (const auto &child : getDebugChildren()) {
if (!child) {
continue;
}
@@ -51,7 +51,7 @@ std::string DebugStringConvertible::getDebugPropsDescription(
std::string propsString;
for (auto const &prop : getDebugProps()) {
for (const auto &prop : getDebugProps()) {
if (!prop) {
continue;
}
@@ -125,22 +125,22 @@ SharedDebugStringConvertibleList DebugStringConvertible::getDebugProps() const {
/*
* `toString`-family implementation.
*/
std::string toString(std::string const &value) {
std::string toString(const std::string &value) {
return value;
}
std::string toString(int const &value) {
std::string toString(const int &value) {
return folly::to<std::string>(value);
}
std::string toString(bool const &value) {
std::string toString(const bool &value) {
return folly::to<std::string>(value);
}
std::string toString(float const &value) {
std::string toString(const float &value) {
return folly::to<std::string>(value);
}
std::string toString(double const &value) {
std::string toString(const double &value) {
return folly::to<std::string>(value);
}
std::string toString(void const *value) {
std::string toString(const void *value) {
if (value == nullptr) {
return "null";
}