Author: Jorge Gorbe Moya Date: 2022-02-28T12:53:59-08:00 New Revision: de9611befeebeb85324062cb1ae8978a82a09e26
URL: https://github.com/llvm/llvm-project/commit/de9611befeebeb85324062cb1ae8978a82a09e26 DIFF: https://github.com/llvm/llvm-project/commit/de9611befeebeb85324062cb1ae8978a82a09e26.diff LOG: [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. Added: Modified: clang-tools-extra/clangd/Format.cpp Removed: ################################################################################ diff --git a/clang-tools-extra/clangd/Format.cpp b/clang-tools-extra/clangd/Format.cpp index adf9cfd39cb68..bb492dbdbd3bd 100644 --- a/clang-tools-extra/clangd/Format.cpp +++ b/clang-tools-extra/clangd/Format.cpp @@ -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)) { _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits