llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: None (yronglin) <details> <summary>Changes</summary> This patch fix a bug introduced by https://github.com/llvm/llvm-project/pull/107168. Consider the following code: ```c #define str(s) # s #define xstr(s) str(s) #define INCFILE(n) vers ## n include xstr(INCFILE(2).h) ``` The period has an unexpected `AtStartOfLine` flag when it's lexed from `TokenLexer`, after phase 4, we expected `include "vers2.h"`, but got `include "vers2 .h"`, an unexpected whitespace occurred before `.`. We only need to propagate `AtStartOfLine` flag when current `TokenLexer` expanding an token stream. --- Full diff: https://github.com/llvm/llvm-project/pull/173052.diff 1 Files Affected: - (modified) clang/lib/Lex/TokenLexer.cpp (+1-1) ``````````diff diff --git a/clang/lib/Lex/TokenLexer.cpp b/clang/lib/Lex/TokenLexer.cpp index e9531ee9794d2..ce072de79b6af 100644 --- a/clang/lib/Lex/TokenLexer.cpp +++ b/clang/lib/Lex/TokenLexer.cpp @@ -632,7 +632,7 @@ bool TokenLexer::Lex(Token &Tok) { // // The 'extern' token should has 'StartOfLine' flag when current TokenLexer // exits and propagate line start/leading space info. - if (isLexingCXXModuleDirective()) { + if (!Macro && isLexingCXXModuleDirective()) { AtStartOfLine = true; setLexingCXXModuleDirective(false); } `````````` </details> https://github.com/llvm/llvm-project/pull/173052 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
