[clang-tidy][NFC] Fix buffer overflow in modernize-use-designated-initializers
Instance of DenseMap were copied into local variable, and as a result reference to string stored in that local variable were returned from function. At the end fix-it were applied with already destroyed string causing some non utf-8 characters to be printed. Related to #80541
This commit is contained in:
parent
cff36bb198
commit
21be2fbd17
@ -43,7 +43,7 @@ struct Designators {
|
||||
unsigned size() { return getCached().size(); }
|
||||
|
||||
std::optional<llvm::StringRef> operator[](const SourceLocation &Location) {
|
||||
const auto Designators = getCached();
|
||||
const auto &Designators = getCached();
|
||||
const auto Result = Designators.find(Location);
|
||||
if (Result == Designators.end())
|
||||
return {};
|
||||
|
Loading…
x
Reference in New Issue
Block a user