[PATCH] D37813: clang-format: better handle namespace macros

Francois Ferrand via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 13 09:28:04 PDT 2017


Typz created this revision.

Other macros are used to declare namespaces, and should thus be handled
similarly. This is the case for crpcut's TESTSUITE macro, or for
unittest-cpp's SUITE macro:

  TESTSUITE(Foo) {
  TEST(MyFirstTest) {
    assert(0);
  }
  } // TESTSUITE(Foo)

This patch deals with this cases by introducing a new option to specify
lists of namespace macros. Internally, it re-uses the system already in
place for foreach and statement macros, to ensure there is no impact on
performance.


https://reviews.llvm.org/D37813

Files:
  include/clang/Format/Format.h
  lib/Format/Format.cpp
  lib/Format/FormatToken.h
  lib/Format/FormatTokenLexer.cpp
  lib/Format/NamespaceEndCommentsFixer.cpp
  lib/Format/TokenAnnotator.cpp
  lib/Format/UnwrappedLineFormatter.cpp
  lib/Format/UnwrappedLineParser.cpp
  unittests/Format/FormatTest.cpp
  unittests/Format/NamespaceEndCommentsFixerTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37813.115058.patch
Type: text/x-patch
Size: 35294 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170913/c4b23347/attachment-0001.bin>


More information about the cfe-commits mailing list