[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
Loading
Please sign in to comment