[NFC] Don't pass temporary LangOptions to Lexer

Since https://reviews.llvm.org/D120334, passing a temporary LangOptions
object to Lexer results in stack-use-after-scope.
This commit is contained in:
Jorge Gorbe Moya 2022-02-28 12:52:43 -08:00
parent f1315c61a0
commit de9611befe
1 changed files with 2 additions and 2 deletions
clang-tools-extra/clangd

View File

@ -25,8 +25,8 @@ void closeBrackets(std::string &Code, const format::FormatStyle &Style) {
SourceManagerForFile FileSM("mock_file.cpp", Code);
auto &SM = FileSM.get();
FileID FID = SM.getMainFileID();
Lexer Lex(FID, SM.getBufferOrFake(FID), SM,
format::getFormattingLangOpts(Style));
LangOptions LangOpts = format::getFormattingLangOpts(Style);
Lexer Lex(FID, SM.getBufferOrFake(FID), SM, LangOpts);
Token Tok;
std::vector<char> Brackets;
while (!Lex.LexFromRawLexer(Tok)) {