[NFC] Don't pass temporary LangOptions to Lexer
Since https://reviews.llvm.org/D120334 we shouldn't pass temporary LangOptions to Lexer. This change fixes stack-use-after-scope UB in LocalizationChecker found by sanitizer-x86_64-linux-fast buildbot and resolve similar issue in HeaderIncludes.
This commit is contained in:
parent
517171ce20
commit
b3e2dac27c
|
@ -1145,8 +1145,8 @@ void EmptyLocalizationContextChecker::MethodCrawler::VisitObjCMessageExpr(
|
|||
Mgr.getSourceManager().getBufferOrNone(SLInfo.first, SL);
|
||||
if (!BF)
|
||||
return;
|
||||
|
||||
Lexer TheLexer(SL, LangOptions(), BF->getBufferStart(),
|
||||
LangOptions LangOpts;
|
||||
Lexer TheLexer(SL, LangOpts, BF->getBufferStart(),
|
||||
BF->getBufferStart() + SLInfo.second, BF->getBufferEnd());
|
||||
|
||||
Token I;
|
||||
|
|
|
@ -43,8 +43,9 @@ unsigned getOffsetAfterTokenSequence(
|
|||
GetOffsetAfterSequence) {
|
||||
SourceManagerForFile VirtualSM(FileName, Code);
|
||||
SourceManager &SM = VirtualSM.get();
|
||||
LangOptions LangOpts = createLangOpts();
|
||||
Lexer Lex(SM.getMainFileID(), SM.getBufferOrFake(SM.getMainFileID()), SM,
|
||||
createLangOpts());
|
||||
LangOpts);
|
||||
Token Tok;
|
||||
// Get the first token.
|
||||
Lex.LexFromRawLexer(Tok);
|
||||
|
|
Loading…
Reference in a new issue