Commit Graph

23 Commits

Author SHA1 Message Date
Daniel Jasper c6dd273a98 clang-format: [Proto] Handle enum bodies differently.
In proto, enum constants can contain complex options and should be
handled more like individual declarations.

Before:
  enum Type {
    UNKNOWN = 0 [(some_options) =
                     {
                       a: aa,
                       b: bb
                     }];
  };

After:
  enum Type {
    UNKNOWN = 0 [(some_options) = {
      a: aa,
      b: bb
    }];
  };

llvm-svn: 242404
2015-07-16 14:25:43 +00:00
Daniel Jasper 23d3bcfe5b clang-format: [Proto] Don't treat "operator" as keyword.
Before:
  optional string operator= 1;

After:
  optional string operator = 1;

llvm-svn: 240624
2015-06-25 08:38:46 +00:00
Alexander Kornienko ab9db51042 Revert r240270 ("Fixed/added namespace ending comments using clang-tidy").
llvm-svn: 240353
2015-06-22 23:07:51 +00:00
Alexander Kornienko 3d9d929e42 Fixed/added namespace ending comments using clang-tidy. NFC
The patch is generated using this command:

  $ tools/extra/clang-tidy/tool/run-clang-tidy.py -fix \
      -checks=-*,llvm-namespace-comment -header-filter='llvm/.*|clang/.*' \
      work/llvm/tools/clang

To reduce churn, not touching namespaces spanning less than 10 lines.

llvm-svn: 240270
2015-06-22 09:47:44 +00:00
Daniel Jasper 1b998815a0 clang-format: [Proto] Don't linewrap top-level options.
They are very similar to import statements.

llvm-svn: 235582
2015-04-23 09:54:10 +00:00
Daniel Jasper 1662bfe077 clang-format: [Proto] No alternate operator names.
llvm-svn: 234055
2015-04-03 21:15:46 +00:00
Daniel Jasper ce2fdb0a0a clang-format: [Proto] Change formatting text-formatted options.
Before:
  optional Type type = 1 [(mutate_options) = {vital : true
                                              abc : false}];

After:
  optional Type type = 1 [(mutate_options) = {
    vital : true
    abc : false
  }];

llvm-svn: 220679
2014-10-27 13:25:59 +00:00
Daniel Jasper 497d9fdcf8 clang-format: [proto] Understand text-format nesting without :
Before:
  option (MyProto.options) = {
    field_c : "OK" msg_field{field_d : 123}
  };

After:
  option (MyProto.options) = {
    field_c : "OK"
    msg_field{field_d : 123}
  };

(Note that the colon after "msg_field" is optional).

llvm-svn: 215692
2014-08-15 05:00:35 +00:00
Daniel Jasper a382cbe4eb clang-format: [proto] Improve formatting of text-proto options.
Initial patch and tests by Kaushik Sridharan, thank you!

llvm-svn: 214084
2014-07-28 14:08:09 +00:00
Daniel Jasper 9c2820c4e3 clang-format: [proto] Add required space before absolute references.
llvm-svn: 211488
2014-06-23 07:36:25 +00:00
Nikola Smiljanic e08a91ecd2 Enable alternative tokens by default for clang-format.
Patch by Bobby Moretti.

llvm-svn: 208269
2014-05-08 00:05:13 +00:00
Daniel Jasper 883ae9d9a3 clang-format: Don't bin-pack text-proto-formatted options.
Before:
  repeated double value = 1
      [(aaaaaaa.aaaaaaaaa) = {aaaaaaaaaaaaaaaa: AAAAAAAAAA,
                              bbbbbbb: BBBB, bbbb: BBB}];

After:
  repeated double value = 1
      [(aaaaaaa.aaaaaaaaa) = {aaaaaaaaaaaaaaaa: AAAAAAAAAA,
                              bbbbbbb: BBBB,
                              bbbb: BBB}];

llvm-svn: 207538
2014-04-29 15:54:14 +00:00
Chandler Carruth 1034666777 [Modules] Fix potential ODR violations by sinking the DEBUG_TYPE
definition below all of the header #include lines, clang edition.

If you want more details about this, you can see some of the commits to
Debug.h in LLVM recently. This is just the clang section of a cleanup
I've done for all uses of DEBUG_TYPE in LLVM.

llvm-svn: 206849
2014-04-22 03:17:02 +00:00
Daniel Jasper 783bac6bba clang-format: Understand proto text format without commas.
Also removed spaces before colons as they don't seem to be used
frequently.

Before:
optional int32 b = 2
    [(foo_options) = {aaaaaaaaaaaaaaaaaaa : 123 bbbbbbbbbbbbbbbbbbbbbbbb :
                          "baz"}];

After:
optional int32 b = 2 [(foo_options) = {aaaaaaaaaaaaaaaaaaa: 123,
                                       bbbbbbbbbbbbbbbbbbbbbbbb:"baz"}];

llvm-svn: 206269
2014-04-15 09:54:30 +00:00
Daniel Jasper 9d3adc06c6 x
llvm-svn: 206268
2014-04-15 09:54:24 +00:00
Daniel Jasper 220c0d1f5e clang-format: Fix false positive in braced list detection in protos.
llvm-svn: 205954
2014-04-10 07:27:12 +00:00
Nico Weber 514ecc8ce8 clang-format: Let chromium style inherit google style's javascript tweaks.
llvm-svn: 200652
2014-02-02 20:50:45 +00:00
Daniel Jasper f24301d79c clang-format: More custom option fixes for protocol buffer files.
Before:
  repeated double value = 1 [(aaaaaaa.aaaaaaaaa) = {
                               aaaaaaaaaaaaaaaa : AAAAAAAAAA,
                               bbbbbbbbbbbbbbbb : BBBBBBBBBB
                             }];

After:
  repeated double value = 1
      [(aaaaaaa.aaaaaaaaa) = {aaaaaaaaaaaaaaaa : AAAAAAAAAA,
                              bbbbbbbbbbbbbbbb : BBBBBBBBBB}];

llvm-svn: 200406
2014-01-29 18:52:43 +00:00
Daniel Jasper 6e58feef76 clang-format: Fix formatting of custom proto options.
Before:
  repeated double value = 1 [(aaaaaaa.aaaaaaaaa) = {
                              aaaaaaaaaaaaaaaaa : AAAAAAAA
                            }];

After:
  repeated double value = 1
      [(aaaaaaa.aaaaaaaaa) = {aaaaaaaaaaaaaaaaa : AAAAAAAA}];

llvm-svn: 200405
2014-01-29 18:43:40 +00:00
Daniel Jasper a0e9be2bb2 clang-format: Fix option formatting in protocol buffer files.
Before:
  optional int32 foo[ default = true, deprecated = true ];

After:
  optional int32 foo[default = true, deprecated = true];

llvm-svn: 200327
2014-01-28 18:51:11 +00:00
Daniel Jasper 215d6c8c50 clang-format: Treat "." in protos like namespace separators.
Before:
  optional really.really.long.and.qualified.type.aaaaaaa
      .aaaaaaaa another_fiiiiiiiiiiiiiiiiiiiiield = 2;

After:
  optional
     really.really.long.and.qualified.type.aaaaaaa.aaaaaaaa
          another_fiiiiiiiiiiiiiiiiiiiiield = 2;

llvm-svn: 199796
2014-01-22 08:04:52 +00:00
Daniel Jasper 929b1db276 clang-format: Properly format custom options in protocol buffer definitions.
Before:
  option(my_option) = "abc";

After:
  option (my_option) = "abc";

llvm-svn: 199672
2014-01-20 16:47:22 +00:00
Daniel Jasper 7052ce6d8b clang-format: Better support and testing for protocol buffers.
With this patch, there is dedicated testing for protocol buffers
(https://developers.google.com/protocol-buffers/).

Also some minor tweaks formatting tweaks.

llvm-svn: 199580
2014-01-19 09:04:08 +00:00