[clang-tools-extra] 54110b8 - Fix use-after-free in clang-apply-replacements
Ben Langmuir via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 2 13:35:11 PDT 2022
Author: Ben Langmuir
Date: 2022-08-02T13:34:20-07:00
New Revision: 54110b8aa01073c428c636951511c2dc710c4a32
URL: https://github.com/llvm/llvm-project/commit/54110b8aa01073c428c636951511c2dc710c4a32
DIFF: https://github.com/llvm/llvm-project/commit/54110b8aa01073c428c636951511c2dc710c4a32.diff
LOG: Fix use-after-free in clang-apply-replacements
Accidentally introduced a dangling StringRef in b4c6dc2e6637.
Differential Revision: https://reviews.llvm.org/D131017
Added:
Modified:
clang-tools-extra/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
Removed:
################################################################################
diff --git a/clang-tools-extra/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp b/clang-tools-extra/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
index 9757d99cd789b..b9e83aca0ab96 100644
--- a/clang-tools-extra/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
+++ b/clang-tools-extra/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
@@ -24,6 +24,7 @@
#include "clang/Tooling/ReplacementsYaml.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/Optional.h"
+#include "llvm/ADT/StringSet.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/Path.h"
@@ -140,7 +141,7 @@ std::error_code collectReplacementsFromDirectory(
static llvm::DenseMap<const FileEntry *, std::vector<tooling::Replacement>>
groupReplacements(const TUReplacements &TUs, const TUDiagnostics &TUDs,
const clang::SourceManager &SM) {
- std::set<StringRef> Warned;
+ llvm::StringSet<> Warned;
llvm::DenseMap<const FileEntry *, std::vector<tooling::Replacement>>
GroupedReplacements;
More information about the cfe-commits
mailing list