Mercurial > hg > CbC > CbC_llvm
diff clang/lib/Lex/Preprocessor.cpp @ 242:b2ae1833b9d9
bug fixing
author | matac |
---|---|
date | Thu, 10 Aug 2023 16:52:17 +0900 |
parents | ca573705d418 |
children | 731cecd08f47 |
line wrap: on
line diff
--- a/clang/lib/Lex/Preprocessor.cpp Thu Aug 10 15:24:13 2023 +0900 +++ b/clang/lib/Lex/Preprocessor.cpp Thu Aug 10 16:52:17 2023 +0900 @@ -1487,6 +1487,7 @@ Token Preprocessor::ReadFromString(const char *src , SourceLocation Loc) { // Push the ( "string" ) tokens into the token stream. MacroInfo *MI = AllocateMacroInfo(Loc); + SmallVector<Token, 16> Tokens; Token Tok; std::unique_ptr<Lexer> lx(new Lexer(CurLexer->getFileID(),getSourceManager().getBufferOrFake(CurLexer->getFileID(), Loc),*this)); lx->InitLexer(src,src,src + strlen(src)); @@ -1495,14 +1496,16 @@ int i = 0; while (Tok.getKind() != tok::TokenKind::eof) { Tok.setLocation(Loc); - MI->AddTokenToBody(Tok); + Tokens.push_back(Tok); Lex(Tok); i++; } Tok.setLocation(Loc); - MI->AddTokenToBody(Tok); i++; + Tokens.push_back(Tok); + i++; MI->DefinitionLength = i; CurLexer = std::move(lx); CurPPLexer = CurLexer.get(); + MI->setTokens(Tokens, BP); EnterMacro(Tok, Loc, MI , 0 ); CurTokenLexer->MacroDefLength = i; return Tok;