Skip to content

Commit dba4250

Browse files
authored
update clang-format (mongodb#754)
1 parent 5870e7a commit dba4250

File tree

349 files changed

+771
-848
lines changed

Some content is hidden

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

349 files changed

+771
-848
lines changed

.clang-format

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
1-
BasedOnStyle: Google
21
AllowShortFunctionsOnASingleLine: Empty
32
AllowShortIfStatementsOnASingleLine: false
43
AllowShortLoopsOnASingleLine: false
4+
BasedOnStyle: Google
55
BinPackArguments: false
66
BinPackParameters: false
77
ColumnLimit: 100
88
Cpp11BracedListStyle: true
99
DerivePointerAlignment: false
10+
IncludeBlocks: Regroup
11+
IncludeCategories:
12+
- Regex: 'prelude\.(hpp|hh)' # preludes
13+
Priority: 1
14+
- Regex: '<[[:alnum:]_.]+>' # system headers
15+
Priority: 2
16+
- Regex: '.*' # driver headers
17+
Priority: 3
1018
IndentWidth: 4
1119
MaxEmptyLinesToKeep: 1
1220
NamespaceIndentation: None

etc/clang_format.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,17 @@
4040
#
4141

4242
# Expected version of clang-format
43-
CLANG_FORMAT_VERSION = "3.8.0"
44-
CLANG_FORMAT_SHORT_VERSION = "3.8"
43+
CLANG_FORMAT_VERSION = "7.0.1"
44+
CLANG_FORMAT_SHORT_VERSION = "7.0"
4545

4646
# Name of clang-format as a binary
4747
CLANG_FORMAT_PROGNAME = "clang-format"
4848

4949
# URL location of the "cached" copy of clang-format to download
5050
# for users which do not have clang-format installed
51-
CLANG_FORMAT_HTTP_LINUX_CACHE = "https://s3.amazonaws.com/boxes.10gen.com/build/clang-format-3.8-rhel55.tar.gz"
51+
CLANG_FORMAT_HTTP_LINUX_CACHE = "https://s3.amazonaws.com/boxes.10gen.com/build/clang-format-7.0.1-rhel70.tar.gz"
5252

53-
CLANG_FORMAT_HTTP_DARWIN_CACHE = "https://s3.amazonaws.com/boxes.10gen.com/build/clang%2Bllvm-3.8.0-x86_64-apple-darwin.tar.xz"
53+
CLANG_FORMAT_HTTP_DARWIN_CACHE = "https://s3.amazonaws.com/boxes.10gen.com/build/clang-format-7.0.1-x86_64-apple-darwin.tar.gz"
5454

5555
# Path in the tarball to the clang-format binary
5656
CLANG_FORMAT_SOURCE_TAR_BASE = string.Template("clang+llvm-$version-$tar_path/bin/" + CLANG_FORMAT_PROGNAME)

examples/add_subdirectory/hello_mongocxx.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
#include <bsoncxx/builder/basic/document.hpp>
1919
#include <bsoncxx/json.hpp>
20-
2120
#include <mongocxx/client.hpp>
2221
#include <mongocxx/instance.hpp>
2322
#include <mongocxx/uri.hpp>

examples/bsoncxx/builder_basic.cpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ int main(int, char**) {
5555
// as a parameter, which appends the keys in-place.
5656
// After the lambda returns, the builder will end the subdocument.
5757

58-
using bsoncxx::builder::basic::sub_document;
5958
using bsoncxx::builder::basic::sub_array;
59+
using bsoncxx::builder::basic::sub_document;
6060

6161
doc.append(kvp("subdocument key",
6262
[](sub_document subdoc) {
@@ -65,14 +65,10 @@ int main(int, char**) {
6565
}),
6666
kvp("subarray key", [](sub_array subarr) {
6767
// subarrays work similarly
68-
subarr.append(1,
69-
types::b_bool{false},
70-
"hello",
71-
5,
72-
[](sub_document subdoc) {
73-
// nesting works too!
74-
subdoc.append(kvp("such", "nesting"), kvp("much", "recurse"));
75-
});
68+
subarr.append(1, types::b_bool{false}, "hello", 5, [](sub_document subdoc) {
69+
// nesting works too!
70+
subdoc.append(kvp("such", "nesting"), kvp("much", "recurse"));
71+
});
7672
}));
7773

7874
// We can get a view of the resulting bson by calling view()

examples/bsoncxx/builder_list.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
#include <chrono>
16+
1517
#include <bsoncxx/builder/list.hpp>
1618
#include <bsoncxx/types.hpp>
1719
#include <bsoncxx/types/bson_value/value.hpp>
18-
#include <chrono>
1920

2021
using namespace bsoncxx;
2122

examples/bsoncxx/builder_stream.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
using namespace bsoncxx;
2121

2222
int main(int, char**) {
23-
using builder::stream::document;
2423
using builder::stream::array;
24+
using builder::stream::document;
2525

2626
// bsoncxx::builder::stream presents an iostream like interface for succinctly
2727
// constructing complex BSON objects.
@@ -44,13 +44,13 @@ int main(int, char**) {
4444
// The stream namespace includes some helpers that can be used similarly
4545
// to the stream manipulators in <iomanip>
4646
// To build a subdocument, use open_document and close_document
47-
using builder::stream::open_document;
4847
using builder::stream::close_document;
48+
using builder::stream::open_document;
4949
doc << "mySubDoc" << open_document << "subdoc key"
5050
<< "subdoc value" << close_document;
5151
// To build a subarray, use open_array and close_array
52-
using builder::stream::open_array;
5352
using builder::stream::close_array;
53+
using builder::stream::open_array;
5454
doc << "mySubArr" << open_array << 1 << types::b_bool{false} << "hello" << close_array;
5555

5656
// There is a special finalize helper that converts a stream to its underlying bson value

examples/bsoncxx/getting_values.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,13 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
#include <bsoncxx/config/prelude.hpp>
16+
1517
#include <cstdlib>
1618

1719
#include <bsoncxx/builder/stream/array.hpp>
1820
#include <bsoncxx/builder/stream/document.hpp>
1921
#include <bsoncxx/builder/stream/helpers.hpp>
20-
#include <bsoncxx/config/prelude.hpp>
2122
#include <bsoncxx/types.hpp>
2223

2324
using namespace bsoncxx;

examples/bsoncxx/view_and_value.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include <iterator>
1818
#include <vector>
1919

20-
#include <bsoncxx/array/view.hpp>
2120
#include <bsoncxx/array/view.hpp>
2221
#include <bsoncxx/builder/basic/array.hpp>
2322
#include <bsoncxx/builder/basic/document.hpp>

examples/mongocxx/automatic_client_side_field_level_encryption.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@
3131
#include <mongocxx/options/data_key.hpp>
3232
#include <mongocxx/options/encrypt.hpp>
3333

34-
using bsoncxx::builder::basic::make_document;
3534
using bsoncxx::builder::basic::kvp;
35+
using bsoncxx::builder::basic::make_document;
3636

37-
using bsoncxx::builder::stream::document;
38-
using bsoncxx::builder::stream::open_array;
3937
using bsoncxx::builder::stream::close_array;
40-
using bsoncxx::builder::stream::open_document;
4138
using bsoncxx::builder::stream::close_document;
39+
using bsoncxx::builder::stream::document;
4240
using bsoncxx::builder::stream::finalize;
41+
using bsoncxx::builder::stream::open_array;
42+
using bsoncxx::builder::stream::open_document;
4343

4444
using bsoncxx::types::bson_value::make_value;
4545

examples/mongocxx/causal_consistency.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@
2929
#include <mongocxx/uri.hpp>
3030
#include <mongocxx/write_concern.hpp>
3131

32-
using bsoncxx::builder::stream::document;
33-
using bsoncxx::builder::stream::open_document;
3432
using bsoncxx::builder::stream::close_document;
33+
using bsoncxx::builder::stream::document;
3534
using bsoncxx::builder::stream::finalize;
35+
using bsoncxx::builder::stream::open_document;
3636

3737
int main() {
3838
using namespace mongocxx;

examples/mongocxx/client_session.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
#include <mongocxx/instance.hpp>
2222
#include <mongocxx/uri.hpp>
2323

24+
using bsoncxx::to_json;
2425
using bsoncxx::builder::basic::kvp;
2526
using bsoncxx::builder::basic::make_document;
26-
using bsoncxx::to_json;
2727
using namespace mongocxx;
2828

2929
int main() {

examples/mongocxx/connect.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#include <bsoncxx/builder/basic/kvp.hpp>
2121
#include <bsoncxx/json.hpp>
2222
#include <bsoncxx/stdx/make_unique.hpp>
23-
2423
#include <mongocxx/client.hpp>
2524
#include <mongocxx/instance.hpp>
2625
#include <mongocxx/logger.hpp>

examples/mongocxx/create.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#include <bsoncxx/builder/basic/document.hpp>
1919
#include <bsoncxx/builder/basic/kvp.hpp>
2020
#include <bsoncxx/types.hpp>
21-
2221
#include <mongocxx/client.hpp>
2322
#include <mongocxx/instance.hpp>
2423
#include <mongocxx/uri.hpp>

examples/mongocxx/document_validation.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include <bsoncxx/builder/basic/document.hpp>
1818
#include <bsoncxx/builder/basic/kvp.hpp>
1919
#include <bsoncxx/stdx/string_view.hpp>
20-
2120
#include <mongocxx/client.hpp>
2221
#include <mongocxx/exception/exception.hpp>
2322
#include <mongocxx/instance.hpp>

examples/mongocxx/exception.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
#include <mongocxx/instance.hpp>
2828
#include <mongocxx/uri.hpp>
2929

30-
using bsoncxx::builder::basic::make_document;
3130
using bsoncxx::builder::basic::kvp;
31+
using bsoncxx::builder::basic::make_document;
3232

3333
int main(int, char**) {
3434
// The mongocxx::instance constructor and destructor initialize and shut down the driver,

examples/mongocxx/explicit_encryption.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@
3030
#include <mongocxx/options/data_key.hpp>
3131
#include <mongocxx/options/encrypt.hpp>
3232

33-
using bsoncxx::builder::basic::make_document;
3433
using bsoncxx::builder::basic::kvp;
34+
using bsoncxx::builder::basic::make_document;
3535

36-
using bsoncxx::builder::stream::document;
37-
using bsoncxx::builder::stream::open_document;
3836
using bsoncxx::builder::stream::close_document;
37+
using bsoncxx::builder::stream::document;
3938
using bsoncxx::builder::stream::finalize;
39+
using bsoncxx::builder::stream::open_document;
4040

4141
using bsoncxx::types::bson_value::make_value;
4242

examples/mongocxx/explicit_encryption_auto_decryption.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@
3030
#include <mongocxx/options/data_key.hpp>
3131
#include <mongocxx/options/encrypt.hpp>
3232

33-
using bsoncxx::builder::basic::make_document;
3433
using bsoncxx::builder::basic::kvp;
34+
using bsoncxx::builder::basic::make_document;
3535

36-
using bsoncxx::builder::stream::document;
37-
using bsoncxx::builder::stream::open_document;
3836
using bsoncxx::builder::stream::close_document;
37+
using bsoncxx::builder::stream::document;
3938
using bsoncxx::builder::stream::finalize;
39+
using bsoncxx::builder::stream::open_document;
4040

4141
using bsoncxx::types::bson_value::make_value;
4242

examples/mongocxx/get_values_from_documents.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020
#include <mongocxx/client.hpp>
2121
#include <mongocxx/instance.hpp>
2222

23+
using bsoncxx::type;
2324
using bsoncxx::builder::basic::kvp;
2425
using bsoncxx::builder::basic::make_array;
2526
using bsoncxx::builder::basic::make_document;
26-
using bsoncxx::type;
2727

2828
// Document model, showing array with nested documents:
2929
//

examples/mongocxx/instance_management.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#include <bsoncxx/stdx/make_unique.hpp>
1919
#include <bsoncxx/stdx/optional.hpp>
2020
#include <bsoncxx/stdx/string_view.hpp>
21-
2221
#include <mongocxx/instance.hpp>
2322
#include <mongocxx/logger.hpp>
2423
#include <mongocxx/pool.hpp>

examples/mongocxx/query.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#include <bsoncxx/builder/basic/document.hpp>
1919
#include <bsoncxx/builder/basic/kvp.hpp>
2020
#include <bsoncxx/json.hpp>
21-
2221
#include <mongocxx/client.hpp>
2322
#include <mongocxx/instance.hpp>
2423
#include <mongocxx/options/find.hpp>

examples/mongocxx/query_projection.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include <bsoncxx/builder/basic/document.hpp>
1818
#include <bsoncxx/builder/basic/kvp.hpp>
1919
#include <bsoncxx/json.hpp>
20-
2120
#include <mongocxx/client.hpp>
2221
#include <mongocxx/instance.hpp>
2322
#include <mongocxx/options/find.hpp>

examples/mongocxx/remove.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
#include <bsoncxx/builder/basic/document.hpp>
1616
#include <bsoncxx/builder/basic/kvp.hpp>
17-
1817
#include <mongocxx/client.hpp>
1918
#include <mongocxx/instance.hpp>
2019
#include <mongocxx/uri.hpp>

examples/mongocxx/server_side_field_level_encryption_enforcement.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@
3030
#include <mongocxx/options/data_key.hpp>
3131
#include <mongocxx/options/encrypt.hpp>
3232

33-
using bsoncxx::builder::basic::make_document;
3433
using bsoncxx::builder::basic::kvp;
34+
using bsoncxx::builder::basic::make_document;
3535

36-
using bsoncxx::builder::stream::document;
37-
using bsoncxx::builder::stream::open_array;
3836
using bsoncxx::builder::stream::close_array;
39-
using bsoncxx::builder::stream::open_document;
4037
using bsoncxx::builder::stream::close_document;
38+
using bsoncxx::builder::stream::document;
4139
using bsoncxx::builder::stream::finalize;
40+
using bsoncxx::builder::stream::open_array;
41+
using bsoncxx::builder::stream::open_document;
4242

4343
using bsoncxx::types::bson_value::make_value;
4444

examples/mongocxx/tailable_cursor.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
#include <bsoncxx/builder/basic/document.hpp>
2020
#include <bsoncxx/json.hpp>
21-
2221
#include <mongocxx/client.hpp>
2322
#include <mongocxx/collection.hpp>
2423
#include <mongocxx/database.hpp>

examples/mongocxx/view_or_value_variant.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,15 @@
1515
#include <bsoncxx/builder/basic/array.hpp>
1616
#include <bsoncxx/builder/basic/document.hpp>
1717
#include <bsoncxx/builder/basic/kvp.hpp>
18-
1918
#include <bsoncxx/stdx/make_unique.hpp>
2019
#include <mongocxx/client.hpp>
2120
#include <mongocxx/instance.hpp>
2221
#include <mongocxx/stdx.hpp>
2322
#include <mongocxx/uri.hpp>
2423

24+
using bsoncxx::builder::basic::array;
2525
using bsoncxx::builder::basic::kvp;
2626
using bsoncxx::builder::basic::make_document;
27-
using bsoncxx::builder::basic::array;
2827

2928
int main(int, char**) {
3029
// The mongocxx::instance constructor and destructor initialize and shut down the driver,

examples/projects/bsoncxx/hello_bsoncxx.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#include <bsoncxx/builder/basic/document.hpp>
1818
#include <bsoncxx/json.hpp>
1919

20-
int main(int, char* []) {
20+
int main(int, char*[]) {
2121
using bsoncxx::builder::basic::kvp;
2222
using bsoncxx::builder::basic::make_document;
2323

examples/projects/mongocxx/hello_mongocxx.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
#include <bsoncxx/builder/basic/document.hpp>
1919
#include <bsoncxx/json.hpp>
20-
2120
#include <mongocxx/client.hpp>
2221
#include <mongocxx/instance.hpp>
2322
#include <mongocxx/uri.hpp>

src/bsoncxx/array/element.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
#include <bsoncxx/array/element.hpp>
16-
#include <bsoncxx/types/bson_value/view.hpp>
15+
#include <bsoncxx/config/private/prelude.hh>
1716

1817
#include <stdexcept>
1918

20-
#include <bsoncxx/config/private/prelude.hh>
19+
#include <bsoncxx/array/element.hpp>
20+
#include <bsoncxx/types/bson_value/view.hpp>
2121

2222
namespace bsoncxx {
2323
BSONCXX_INLINE_NAMESPACE_BEGIN
@@ -47,6 +47,6 @@ bool BSONCXX_CALL operator!=(const types::bson_value::view& v, const element& el
4747
return !(elem == v);
4848
}
4949

50-
} // namespace document
50+
} // namespace array
5151
BSONCXX_INLINE_NAMESPACE_END
5252
} // namespace bsoncxx

0 commit comments

Comments
 (0)