[PATCH] D138047: Fix use of dangling stack allocated string in IncludeFixer
David Goldman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 16 11:09:54 PST 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rG2d5c4b8f6e04: Fix use of dangling stack allocated string in IncludeFixer (authored by dgoldman).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D138047/new/
https://reviews.llvm.org/D138047
Files:
clang-tools-extra/clangd/ParsedAST.cpp
Index: clang-tools-extra/clangd/ParsedAST.cpp
===================================================================
--- clang-tools-extra/clangd/ParsedAST.cpp
+++ clang-tools-extra/clangd/ParsedAST.cpp
@@ -465,6 +465,8 @@
std::vector<std::unique_ptr<tidy::ClangTidyCheck>> CTChecks;
ast_matchers::MatchFinder CTFinder;
llvm::Optional<tidy::ClangTidyContext> CTContext;
+ // Must outlive FixIncludes.
+ auto BuildDir = VFS->getCurrentWorkingDirectory();
llvm::Optional<IncludeFixer> FixIncludes;
llvm::DenseMap<diag::kind, DiagnosticsEngine::Level> OverriddenSeverity;
// No need to run clang-tidy or IncludeFixerif we are not going to surface
@@ -551,7 +553,6 @@
// Add IncludeFixer which can recover diagnostics caused by missing includes
// (e.g. incomplete type) and attach include insertion fixes to diagnostics.
- auto BuildDir = VFS->getCurrentWorkingDirectory();
if (Inputs.Index && !BuildDir.getError()) {
auto Style =
getFormatStyleForFile(Filename, Inputs.Contents, *Inputs.TFS);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D138047.475876.patch
Type: text/x-patch
Size: 1046 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221116/31bbdd9b/attachment.bin>
More information about the cfe-commits
mailing list