Ran clang-format on all C++ sources (#1396)

diff --git a/.clang-format b/.clang-format
new file mode 100644
index 0000000..2296f7d
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1,3 @@
+---
+BasedOnStyle: Google
+...
diff --git a/examples/ambiguous_deps/cc_library_with_func.cc b/examples/ambiguous_deps/cc_library_with_func.cc
index 536fa93..1f12151 100644
--- a/examples/ambiguous_deps/cc_library_with_func.cc
+++ b/examples/ambiguous_deps/cc_library_with_func.cc
@@ -1,3 +1 @@
-extern "C" int func() {
-  return 123;
-}
+extern "C" int func() { return 123; }
diff --git a/examples/ffi/rust_calling_c/c/matrix.h b/examples/ffi/rust_calling_c/c/matrix.h
index 40797a2..cfe917b 100644
--- a/examples/ffi/rust_calling_c/c/matrix.h
+++ b/examples/ffi/rust_calling_c/c/matrix.h
@@ -45,4 +45,4 @@
 // Frees the matrix.
 void matrix_free(Matrix* matrix);
 
-#endif // MATRIX_SRC_MATRIX_H_
+#endif  // MATRIX_SRC_MATRIX_H_
diff --git a/examples/ffi/rust_calling_c/c/matrix_test.c b/examples/ffi/rust_calling_c/c/matrix_test.c
index d7bb76b..ab81269 100644
--- a/examples/ffi/rust_calling_c/c/matrix_test.c
+++ b/examples/ffi/rust_calling_c/c/matrix_test.c
@@ -25,7 +25,7 @@
     for (size_t j = 0; j < m->cols; ++j) {
       uint64_t val = 0;
       matrix_at(m, i, j, &val);
-      printf("%"PRIu64" ", val);
+      printf("%" PRIu64 " ", val);
     }
     printf("\n");
   }
@@ -44,30 +44,38 @@
 }
 
 void test_equal() {
+  // clang-format off
   static uint64_t a_data[] = {11, 12, 13, 14,
                               21, 22, 23, 24};
+  // clang-format on
   Matrix* a = matrix_new(2, 4, a_data);
   assert(a != NULL);
   assert(check_equal(a, a));
 
+  // clang-format off
   static uint64_t b_data[] = {13, 14, 15, 16,
                               22, 23, 24, 25};
+  // clang-format on
   Matrix* b = matrix_new(2, 4, b_data);
   assert(b != NULL);
   assert(!matrix_equal(a, b));
 }
 
 void test_transpose() {
+  // clang-format off
   static uint64_t matrix_data[] = {11, 12, 13, 14,
                                    21, 22, 23, 24};
+  // clang-format on
   Matrix* matrix = matrix_new(2, 4, matrix_data);
   assert(matrix != NULL);
   matrix_transpose(matrix);
 
+  // clang-format off
   static uint64_t expected_transpose_data[] = {11, 21,
                                                12, 22,
                                                13, 23,
                                                14, 24};
+  // clang-format off
   Matrix* expected_transpose = matrix_new(4, 2, expected_transpose_data);
 
   assert(check_equal(expected_transpose, matrix));
diff --git a/examples/shared_libs/cc_library_with_func.cc b/examples/shared_libs/cc_library_with_func.cc
index 536fa93..1f12151 100644
--- a/examples/shared_libs/cc_library_with_func.cc
+++ b/examples/shared_libs/cc_library_with_func.cc
@@ -1,3 +1 @@
-extern "C" int func() {
-  return 123;
-}
+extern "C" int func() { return 123; }
diff --git a/test/linker_inputs_propagation/baz.cc b/test/linker_inputs_propagation/baz.cc
index 91805e8..a46b501 100644
--- a/test/linker_inputs_propagation/baz.cc
+++ b/test/linker_inputs_propagation/baz.cc
@@ -5,6 +5,6 @@
 extern "C" int32_t double_foo();
 
 int main(int argc, char** argv) {
-    assert(double_foo() == 84);
-    return EXIT_SUCCESS;
+  assert(double_foo() == 84);
+  return EXIT_SUCCESS;
 }
diff --git a/test/linker_inputs_propagation/foo_shared.cc b/test/linker_inputs_propagation/foo_shared.cc
index c3fc2dd..f569afb 100644
--- a/test/linker_inputs_propagation/foo_shared.cc
+++ b/test/linker_inputs_propagation/foo_shared.cc
@@ -1,7 +1,5 @@
 #include <stdint.h>
 
 extern "C" {
-    int32_t foo() {
-        return 42;
-    }
+int32_t foo() { return 42; }
 }
diff --git a/test/linker_inputs_propagation/foo_shared.h b/test/linker_inputs_propagation/foo_shared.h
index 3abc47d..40acc2d 100644
--- a/test/linker_inputs_propagation/foo_shared.h
+++ b/test/linker_inputs_propagation/foo_shared.h
@@ -1,5 +1,5 @@
 #include <stdint.h>
 
 extern "C" {
-    int32_t foo();
+int32_t foo();
 }
diff --git a/test/process_wrapper/process_wrapper_tester.cc b/test/process_wrapper/process_wrapper_tester.cc
index 7cf1c02..ab4e96e 100644
--- a/test/process_wrapper/process_wrapper_tester.cc
+++ b/test/process_wrapper/process_wrapper_tester.cc
@@ -53,7 +53,8 @@
     if (env.rfind("CURRENT_DIR", 0) == 0) {
       found = true;
       if (env.find("${pwd}") != std::string::npos) {
-        std::cerr << "error: environment variable ${pwd} substitution failed.\n";
+        std::cerr
+            << "error: environment variable ${pwd} substitution failed.\n";
         std::exit(1);
       }
       break;
@@ -131,9 +132,7 @@
   }
 }
 
-void test_stderr() {
-  std::cerr << "This is the stderr output";
-}
+void test_stderr() { std::cerr << "This is the stderr output"; }
 
 int main(int argc, const char* argv[], const char* envp[]) {
   if (argc < 4) {
diff --git a/test/unit/proc_macro/leaks_deps/native/native.cc b/test/unit/proc_macro/leaks_deps/native/native.cc
index 7c6f54d..04db727 100644
--- a/test/unit/proc_macro/leaks_deps/native/native.cc
+++ b/test/unit/proc_macro/leaks_deps/native/native.cc
@@ -1,7 +1,5 @@
 #include <stdint.h>
 
 extern "C" {
-    int32_t forty_two_from_cc() {
-        return 42;
-    }
+int32_t forty_two_from_cc() { return 42; }
 }
diff --git a/test/unit/win_interface_library/bin.cc b/test/unit/win_interface_library/bin.cc
index a3c073a..b8bd84e 100644
--- a/test/unit/win_interface_library/bin.cc
+++ b/test/unit/win_interface_library/bin.cc
@@ -1,6 +1,6 @@
 extern "C" void hello(void);
 
 int main(int argc, char **argv) {
-    hello();
-    return 0;
+  hello();
+  return 0;
 }
diff --git a/test/versioned_dylib/c/return_zero.c b/test/versioned_dylib/c/return_zero.c
index ea3e6d8..ef72eaa 100644
--- a/test/versioned_dylib/c/return_zero.c
+++ b/test/versioned_dylib/c/return_zero.c
@@ -1,5 +1,3 @@
 #include "return_zero.h"
 
-int return_zero() {
-    return 0;
-}
\ No newline at end of file
+int return_zero() { return 0; }
diff --git a/test/versioned_dylib/c/return_zero.h b/test/versioned_dylib/c/return_zero.h
index 4e7cb4a..5f55f77 100644
--- a/test/versioned_dylib/c/return_zero.h
+++ b/test/versioned_dylib/c/return_zero.h
@@ -1,6 +1,6 @@
 #ifndef versioned_lib_h__
 #define versioned_lib_h__
- 
+
 extern int return_zero();
- 
-#endif  // versioned_lib_h__
\ No newline at end of file
+
+#endif  // versioned_lib_h__
diff --git a/util/import/fake_import_macro_impl.cc b/util/import/fake_import_macro_impl.cc
index d4b502e..5b0b32a 100755
--- a/util/import/fake_import_macro_impl.cc
+++ b/util/import/fake_import_macro_impl.cc
@@ -1,5 +1,3 @@
 //! A noop import macro handler.
 
-int main(int argc, char** argv) {
-    return 0;
-}
+int main(int argc, char** argv) { return 0; }