diff options
author | Jan Svoboda <jan_svoboda@apple.com> | 2022-02-15 09:49:00 +0100 |
---|---|---|
committer | Jan Svoboda <jan_svoboda@apple.com> | 2022-02-15 09:49:03 +0100 |
commit | fd2dff17c53dbfd89789989bedd949c496e7b6b7 (patch) | |
tree | cfb41cd8f5bac5407593a9b8e8a090b0ae154d4a /llvm/lib/Bitcode/Reader/BitcodeReader.cpp | |
parent | edd09bb5a49c6a5dac29714af661d1ddffe50a72 (diff) | |
download | llvm-fd2dff17c53dbfd89789989bedd949c496e7b6b7.zip llvm-fd2dff17c53dbfd89789989bedd949c496e7b6b7.tar.gz llvm-fd2dff17c53dbfd89789989bedd949c496e7b6b7.tar.bz2 |
[clang][lex][minimizer] Ensure whitespace between squashed lines
The minimizer tries to squash multi-line macro definitions into single line. For that to work, contents of each line need to be separated by a space. Since we always strip leading whitespace on lines of a macro definition, the code currently tries to preserve exactly one space that appeared before the backslash.
This means the following code:
```
#define FOO(BAR) \
#BAR \
baz
```
gets minimized into:
```
#define FOO(BAR) #BAR baz
```
However, if there are no spaces before the backslash on line 2:
```
#define FOO(BAR) \
#BAR\
baz
```
no space can be preserved, leading to (most likely) malformed macro definition:
```
#define FOO(BAR) #BARbaz
```
This patch makes sure we always put exactly one space at the end of line ending with a backslash.
Reviewed By: arphaman
Differential Revision: https://reviews.llvm.org/D119231
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
0 files changed, 0 insertions, 0 deletions