llvm-project/clang/lib/Format
Jake Merdich 0c332a7784 [clang-format] Preserve whitespace in selected macros
Summary:
https://bugs.llvm.org/show_bug.cgi?id=46383

When the c preprocessor stringizes tokens, the generated string literals
are affected by the whitespace. This means clang-format can affect
codegen silently, adding spaces and newlines to strings.  Practically
speaking, the vast majority of cases will be harmless, only affecting
single identifiers or debug macros.

In the interest of doing no harm in other cases though, this introduces
a blacklist option 'WhitespaceSensitiveMacros', which contains a list of
names of function-like macros whose contents should not be touched by
clang-format, period. Clang-format can't automatically detect these
without a real compile context, so users will have to specify it
explicitly (it still beats clang-format off'ing at every invocation).

Defaults include "STRINGIZE", "PP_STRINGIZE", and "BOOST_PP_STRINGIZE".

Subscribers: kristof.beyls, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D82620
2020-06-29 09:57:47 -04:00
..
AffectedRangeManager.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
AffectedRangeManager.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
BreakableToken.cpp [clang-format] use spaces for alignment with UT_ForContinuationAndIndentation 2020-04-13 15:14:26 +01:00
BreakableToken.h [clang][NFC] Make various uses of Regex const 2019-11-19 16:15:21 +00:00
CMakeLists.txt Reland "Move #include manipulation code to new lib/Tooling/Inclusions." 2018-06-04 09:04:12 +00:00
ContinuationIndenter.cpp [clang-format] restore indent in conditionals when AlignOperands is DontAlign 2020-06-24 13:11:18 +02:00
ContinuationIndenter.h [clang-format] Fix AlignOperands when BreakBeforeBinaryOperators is set 2020-05-15 16:40:31 +02:00
Encoding.h [clang-format][PR41964] Fix crash with SIGFPE when TabWidth is set to 0 and line starts with tab 2019-09-18 18:57:09 +00:00
Format.cpp [clang-format] Preserve whitespace in selected macros 2020-06-29 09:57:47 -04:00
FormatInternal.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
FormatToken.cpp [ARM] Add __bf16 as new Bfloat16 C Type 2020-06-05 10:32:43 +01:00
FormatToken.h [clang-format] Preserve whitespace in selected macros 2020-06-29 09:57:47 -04:00
FormatTokenLexer.cpp [clang-format] Preserve whitespace in selected macros 2020-06-29 09:57:47 -04:00
FormatTokenLexer.h [clang-format] [PR46159] Linux kernel 'C' code uses 'try' as a variable name, allow clang-format to handle such cases 2020-06-03 20:44:45 +01:00
NamespaceEndCommentsFixer.cpp [clang-format] [PR46130] When editing a file with unbalance {} the namespace comment fixer can incorrectly comment the wrong closing brace 2020-05-30 13:15:27 +01:00
NamespaceEndCommentsFixer.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
SortJavaScriptImports.cpp [ADT/STLExtras.h] - Add llvm::is_sorted wrapper and update callers. 2020-04-14 14:11:02 +03:00
SortJavaScriptImports.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
TokenAnalyzer.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
TokenAnalyzer.h [clang-format] Remove unused Environment constructor. 2019-04-18 00:36:51 +00:00
TokenAnnotator.cpp [clang-format] Preserve whitespace in selected macros 2020-06-29 09:57:47 -04:00
TokenAnnotator.h clang-format clang/lib/Format 2019-07-29 13:26:48 +00:00
UnwrappedLineFormatter.cpp [clang-format] [PR462254] fix indentation of default and break correctly in whitesmiths style 2020-06-27 11:35:22 +01:00
UnwrappedLineFormatter.h [clang-format] [NFC] clang-format the Format library 2019-03-01 09:09:54 +00:00
UnwrappedLineParser.cpp [clang-format] [PR462254] fix indentation of default and break correctly in whitesmiths style 2020-06-27 11:35:22 +01:00
UnwrappedLineParser.h [clang-format] Fix an ObjC regression introduced with new [[likely]][[unlikely]] support in if/else clauses 2020-05-26 18:48:49 +01:00
UsingDeclarationsSorter.cpp Use llvm::stable_sort 2019-04-24 14:43:05 +00:00
UsingDeclarationsSorter.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
WhitespaceManager.cpp [clang-format][PR45816] Add AlignConsecutiveBitFields 2020-05-20 07:42:58 +01:00
WhitespaceManager.h [clang-format][PR45816] Add AlignConsecutiveBitFields 2020-05-20 07:42:58 +01:00