[clang] [C++20][Modules] Implement P1857R3 Modules Dependency Discovery (PR #107168)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 17 09:17:14 PDT 2025
================
@@ -4020,11 +4036,25 @@ bool Lexer::LexTokenInternal(Token &Result, bool TokAtPhysicalStartOfLine) {
case 'h': case 'i': case 'j': case 'k': case 'l': case 'm': case 'n':
case 'o': case 'p': case 'q': case 'r': case 's': case 't': /*'u'*/
case 'v': case 'w': case 'x': case 'y': case 'z':
- case '_':
+ case '_': {
// Notify MIOpt that we read a non-whitespace/non-comment token.
MIOpt.ReadToken();
- return LexIdentifierContinue(Result, CurPtr);
-
+ bool returnedToken = LexIdentifierContinue(Result, CurPtr);
+
+ // Check eof token first, because eof token may be encountered in
+ // LexIdentifierContinue, and the current lexer will be deleted in
+ // HandleEndOfFile, causing members(eg. LangOpts) to become an inaccessible
+ // dangling reference.
+ //
+ // FIXME: Whether a more reasonable memory management method needed? such as
----------------
yronglin wrote:
Thanks, SGTM!
https://github.com/llvm/llvm-project/pull/107168
More information about the cfe-commits
mailing list