Skip to content

Commit

Permalink
Upgrade clang-format to v18 (#12483)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewheard authored Mar 7, 2024
1 parent 89526bf commit 5797426
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 20 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ To develop Firebase software, **install**:
To install [clang-format] and [mint] using [Homebrew]:

```console
brew install clang-format@17
brew install clang-format@18
brew install mint
```

Expand Down
7 changes: 4 additions & 3 deletions FirebaseDatabase/Tests/Integration/FData.m
Original file line number Diff line number Diff line change
Expand Up @@ -314,9 +314,10 @@ - (void)testWriteLeafNodeOverwriteAtParentMultipleTimesVerifyExpectedEvents {
ios - sdk / firebase - ios -
sdk / Example / Database / Tests / Helpers /
FEventTester
.m : 123 because it was raised inside test case -[FEventTester(null)] which has no
associated XCTestRun object.This may happen when test cases are
constructed and invoked independently of standard XCTest infrastructure,
.m : 123 because it was raised inside test case -
[FEventTester(
null)] which has no associated XCTestRun object.This may happen when test cases
are constructed and invoked independently of standard XCTest infrastructure,
or when the test has already finished
." - Expected http://localhost:9000/-M8IJYWb68MuqQKKz2IY/a aa (0) to match "
"http://localhost:9000/-M8IJYWb68MuqQKKz2IY/a (null) (4)' from "
Expand Down
4 changes: 1 addition & 3 deletions FirebaseDatabase/Tests/Integration/FIRDatabaseQueryTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -4192,9 +4192,7 @@ - (void)testGetForParentReturnsCorrectValue {

[ref getDataWithCompletionBlock:^(NSError* err, FIRDataSnapshot* snapshot) {
XCTAssertNil(err);
XCTAssertEqualObjects(
[snapshot value],
@{@"a" : @1});
XCTAssertEqualObjects([snapshot value], @{@"a" : @1});
done = YES;
}];
}
Expand Down
4 changes: 1 addition & 3 deletions FirebaseDatabase/Tests/Integration/FOrderByTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,7 @@ - (void)testFiresChildMovedEvents {
moved = YES;
XCTAssertEqualObjects(snapshot.key, @"greg", @"");
XCTAssertEqualObjects(prevName, @"rob", @"");
XCTAssertEqualObjects(
snapshot.value,
@{@"nuggets" : @57}, @"");
XCTAssertEqualObjects(snapshot.value, @{@"nuggets" : @57}, @"");
}];

[ref setValue:initial];
Expand Down
4 changes: 2 additions & 2 deletions Firestore/core/src/immutable/keys_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ auto KeysView(const Range& range) -> KeysRange<decltype(std::begin(range))> {
}

template <typename Range, typename K>
auto KeysViewFrom(const Range& range, const K& key)
-> KeysRange<decltype(range.lower_bound(key))> {
auto KeysViewFrom(const Range& range,
const K& key) -> KeysRange<decltype(range.lower_bound(key))> {
auto keys_begin = util::make_iterator_first(range.lower_bound(key));
auto keys_end = util::make_iterator_first(std::end(range));
return util::make_range(keys_begin, keys_end);
Expand Down
8 changes: 4 additions & 4 deletions Firestore/core/src/util/hashing.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@ auto RankedInvokeHash(const Range& range, HashChoice<3>)
* value can itself be hashed.
*/
template <typename K>
auto RankedInvokeHash(const absl::optional<K>& option, HashChoice<4>)
-> decltype(InvokeHash(*option)) {
auto RankedInvokeHash(const absl::optional<K>& option,
HashChoice<4>) -> decltype(InvokeHash(*option)) {
return option ? InvokeHash(*option) : -1171;
}

Expand All @@ -202,8 +202,8 @@ size_t RankedInvokeHash(K value, HashChoice<5>) {
}

template <typename K>
auto RankedInvokeHash(const std::unique_ptr<K>& ptr, HashChoice<6>)
-> decltype(InvokeHash(*ptr)) {
auto RankedInvokeHash(const std::unique_ptr<K>& ptr,
HashChoice<6>) -> decltype(InvokeHash(*ptr)) {
return ptr ? InvokeHash(*ptr) : 23631;
}

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ GitHub Actions will verify that any code changes are done in a style-compliant
way. Install `clang-format` and `mint`:

```console
brew install clang-format@17
brew install clang-format@18
brew install mint
```

Expand Down
2 changes: 1 addition & 1 deletion scripts/setup_check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ fi

# install clang-format
brew update
brew install clang-format@17
brew install clang-format@18

# mint installs tools from Mintfile on demand.
brew install mint
Expand Down
4 changes: 2 additions & 2 deletions scripts/style.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ version="${version/ (*)/}"
version="${version/.*/}"

case "$version" in
17)
18)
;;
google3-trunk)
echo "Please use a publicly released clang-format; a recent LLVM release"
Expand All @@ -65,7 +65,7 @@ case "$version" in
exit 1
;;
*)
echo "Please upgrade to clang-format version 17."
echo "Please upgrade to clang-format version 18."
echo "If it's installed via homebrew you can run:"
echo "brew upgrade clang-format"
exit 1
Expand Down

0 comments on commit 5797426

Please sign in to comment.