llvm-project/clang/unittests/Format
Mark Zeren d2b2ac6886 [clang-format] Align preprocessor comments with #
Summary:
r312125, which introduced preprocessor indentation, shipped with a known
issue where "indentation of comments immediately before indented
preprocessor lines is toggled on each run". For example these two forms
toggle:

  #ifndef HEADER_H
  #define HEADER_H
  #if 1
  // comment
  #   define A 0
  #endif
  #endif

  #ifndef HEADER_H
  #define HEADER_H
  #if 1
     // comment
  #   define A 0
  #endif
  #endif

This happens because we check vertical alignment against the '#' yet
indent to the level of the 'define'. This patch resolves this issue by
aligning against the '#'.

Reviewers: krasimir, klimek, djasper

Reviewed By: krasimir

Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D42408

llvm-svn: 323904
2018-01-31 20:05:50 +00:00
..
CMakeLists.txt [CMake] Use PRIVATE in target_link_libraries for executables 2017-12-05 21:49:56 +00:00
CleanupTest.cpp clang-format: [JS] do not clean up duplicated commas. 2017-05-29 08:41:11 +00:00
FormatTest.cpp [clang-format] Align preprocessor comments with # 2018-01-31 20:05:50 +00:00
FormatTestComments.cpp Fix bug where we wouldn't break columns over the limit. 2017-12-04 08:53:16 +00:00
FormatTestJS.cpp clang-format: [JS] Prevent ASI before [ and (. 2018-01-26 15:07:49 +00:00
FormatTestJava.cpp clang-format: Support formatting Java 8 interface default methods. 2018-01-23 16:30:56 +00:00
FormatTestObjC.cpp [clang-format] Add more tests for ObjC protocol list formatting behavior 2018-01-29 20:01:49 +00:00
FormatTestProto.cpp [clang-format] Adds space around braces in text protos 2018-01-31 10:14:10 +00:00
FormatTestRawStrings.cpp [clang-format] Adds space around braces in text protos 2018-01-31 10:14:10 +00:00
FormatTestSelective.cpp [clang-format] Handle trailing comment sections in import statement lines 2017-05-19 10:34:57 +00:00
FormatTestTextProto.cpp [clang-format] Adds space around braces in text protos 2018-01-31 10:14:10 +00:00
FormatTestUtils.h clang-format: Add preprocessor directive indentation 2017-08-30 14:34:57 +00:00
NamespaceEndCommentsFixerTest.cpp clang-format: fix block OpeningLineIndex around preprocessor 2017-07-28 07:56:14 +00:00
SortImportsTestJS.cpp clang-format: [JS] support default imports. 2017-08-01 15:54:43 +00:00
SortIncludesTest.cpp [clang-format] Add option to group multiple #include blocks when sorting includes 2017-11-27 13:23:45 +00:00
UsingDeclarationsSorterTest.cpp [clang-format] Deduplicate using declarations 2017-11-24 18:00:01 +00:00