Skip to content

Commit

Permalink
[NFC] Don't pass temporary LangOptions to Lexer
Browse files Browse the repository at this point in the history
Since https://reviews.llvm.org/D120334, passing a temporary LangOptions
object to Lexer results in stack-use-after-scope.
  • Loading branch information
slackito committed Feb 28, 2022
1 parent f1315c6 commit de9611b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions clang-tools-extra/clangd/Format.cpp
Expand Up @@ -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)) {
Expand Down

0 comments on commit de9611b

Please sign in to comment.