Fix use-after-free in clang-apply-replacements

Accidentally introduced a dangling StringRef in b4c6dc2e66.

Differential Revision: https://reviews.llvm.org/D131017
This commit is contained in:
Ben Langmuir 2022-08-02 13:33:12 -07:00
parent d7100b398b
commit 54110b8aa0

View File

@ -24,6 +24,7 @@
#include "clang/Tooling/ReplacementsYaml.h" #include "clang/Tooling/ReplacementsYaml.h"
#include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/Optional.h" #include "llvm/ADT/Optional.h"
#include "llvm/ADT/StringSet.h"
#include "llvm/Support/FileSystem.h" #include "llvm/Support/FileSystem.h"
#include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/Path.h" #include "llvm/Support/Path.h"
@ -140,7 +141,7 @@ std::error_code collectReplacementsFromDirectory(
static llvm::DenseMap<const FileEntry *, std::vector<tooling::Replacement>> static llvm::DenseMap<const FileEntry *, std::vector<tooling::Replacement>>
groupReplacements(const TUReplacements &TUs, const TUDiagnostics &TUDs, groupReplacements(const TUReplacements &TUs, const TUDiagnostics &TUDs,
const clang::SourceManager &SM) { const clang::SourceManager &SM) {
std::set<StringRef> Warned; llvm::StringSet<> Warned;
llvm::DenseMap<const FileEntry *, std::vector<tooling::Replacement>> llvm::DenseMap<const FileEntry *, std::vector<tooling::Replacement>>
GroupedReplacements; GroupedReplacements;