diff options
-rw-r--r-- | clang/lib/Lex/TokenLexer.cpp | 1 | ||||
-rw-r--r-- | clang/test/Preprocessor/macro_expand_empty.c | 9 |
2 files changed, 9 insertions, 1 deletions
diff --git a/clang/lib/Lex/TokenLexer.cpp b/clang/lib/Lex/TokenLexer.cpp index 316fba76ccd..40e9707b7b8 100644 --- a/clang/lib/Lex/TokenLexer.cpp +++ b/clang/lib/Lex/TokenLexer.cpp @@ -474,6 +474,7 @@ bool TokenLexer::Lex(Token &Tok) { } else { // If this is not the first token, we may still need to pass through // leading whitespace if we've expanded a macro. + if (AtStartOfLine) Tok.setFlag(Token::StartOfLine); if (HasLeadingSpace) Tok.setFlag(Token::LeadingSpace); } AtStartOfLine = false; diff --git a/clang/test/Preprocessor/macro_expand_empty.c b/clang/test/Preprocessor/macro_expand_empty.c index 3fb6394dc9e..c3fc4f2964e 100644 --- a/clang/test/Preprocessor/macro_expand_empty.c +++ b/clang/test/Preprocessor/macro_expand_empty.c @@ -1,4 +1,5 @@ -// RUN: %clang_cc1 -fsyntax-only %s +// RUN: %clang_cc1 -E %s | FileCheck --strict-whitespace %s + // Check that this doesn't crash #define IDENTITY1(x) x @@ -12,3 +13,9 @@ #define IDENTITY9(x) IDENTITY8(x) IDENTITY8(x) IDENTITY8(x) IDENTITY8(x) #define IDENTITY0(x) IDENTITY9(x) IDENTITY9(x) IDENTITY9(x) IDENTITY9(x) IDENTITY0() + +#define FOO() BAR() second +#define BAR() +first // CHECK: {{^}}first{{$}} +FOO() // CHECK: second +third // CHECK: {{^}}third{{$}} |