================
@@ -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
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to