changeset 199:5784c86f13b3

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Thu, 03 Jun 2021 00:48:49 +0900
parents cef006dc7fd5
children 40b1cab18437
files clang/lib/Lex/Preprocessor.cpp clang/lib/Parse/ParseCbC.cpp
diffstat 2 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/clang/lib/Lex/Preprocessor.cpp	Wed Jun 02 23:09:47 2021 +0900
+++ b/clang/lib/Lex/Preprocessor.cpp	Thu Jun 03 00:48:49 2021 +0900
@@ -1442,6 +1442,7 @@
     bool Invalid = false;
     Lexer lx(CurLexer->getFileID(),getSourceManager().getBuffer(CurLexer->getFileID(), Loc, &Invalid),*this);
     lx.InitLexer(src,src,src + strlen(src));
+    lx.ParsingPreprocessorDirective = true ; // to prevent from EOF sucide of CurLexer in PP
     lx.Lex(Tok);
     FirstTok = Tok;
     while (Tok.getKind() != tok::TokenKind::eof) {
@@ -1449,6 +1450,7 @@
       lx.Lex(Tok);
     }
     EnterMacro(Result, Loc, MI , 0 );
+    // EnterTokenStream(&MI->ReplacementTokens,MI->getNumTokens(),true,true,false);
     return Result;
 }
 
--- a/clang/lib/Parse/ParseCbC.cpp	Wed Jun 02 23:09:47 2021 +0900
+++ b/clang/lib/Parse/ParseCbC.cpp	Thu Jun 03 00:48:49 2021 +0900
@@ -241,7 +241,7 @@
     CompoundStmts.push_back(innerRes.get());
 
   // jmp_buf env_buf;   --> int env_buf[64];
-  Tok = PP.ReadFromString("int env_buf[64];",Loc);
+  Tok = PP.ReadFromString("int env_buf[64];;",Loc);
   ConsumeAnyToken();
   // innerRes = CreateDeclStmt(bufII, false, false, 64, DeclSpec::TST_typename, CreateIdentifierInfo("int", Loc));
   StmtVector Stmts;