forked from OSchip/llvm-project
Fix dangling StringRefs found by clang-tidy misc-dangling-handle check.
llvm-svn: 307085
This commit is contained in:
parent
a66a98cc74
commit
656466ed0b
|
@ -383,7 +383,7 @@ loadAllFilesForIndex(const ModuleSummaryIndex &Index) {
|
|||
|
||||
for (auto &ModPath : Index.modulePaths()) {
|
||||
const auto &Filename = ModPath.first();
|
||||
auto CurrentActivity = "loading file '" + Filename + "'";
|
||||
std::string CurrentActivity = ("loading file '" + Filename + "'").str();
|
||||
auto InputOrErr = MemoryBuffer::getFile(Filename);
|
||||
error(InputOrErr, "error " + CurrentActivity);
|
||||
InputBuffers.push_back(std::move(*InputOrErr));
|
||||
|
@ -475,7 +475,7 @@ private:
|
|||
std::vector<std::unique_ptr<MemoryBuffer>> InputBuffers;
|
||||
for (unsigned i = 0; i < InputFilenames.size(); ++i) {
|
||||
auto &Filename = InputFilenames[i];
|
||||
StringRef CurrentActivity = "loading file '" + Filename + "'";
|
||||
std::string CurrentActivity = "loading file '" + Filename + "'";
|
||||
auto InputOrErr = MemoryBuffer::getFile(Filename);
|
||||
error(InputOrErr, "error " + CurrentActivity);
|
||||
InputBuffers.push_back(std::move(*InputOrErr));
|
||||
|
@ -710,7 +710,7 @@ private:
|
|||
std::vector<std::unique_ptr<MemoryBuffer>> InputBuffers;
|
||||
for (unsigned i = 0; i < InputFilenames.size(); ++i) {
|
||||
auto &Filename = InputFilenames[i];
|
||||
StringRef CurrentActivity = "loading file '" + Filename + "'";
|
||||
std::string CurrentActivity = "loading file '" + Filename + "'";
|
||||
auto InputOrErr = MemoryBuffer::getFile(Filename);
|
||||
error(InputOrErr, "error " + CurrentActivity);
|
||||
InputBuffers.push_back(std::move(*InputOrErr));
|
||||
|
|
|
@ -1637,7 +1637,11 @@ static StringRef getBaseRelocTypeName(uint8_t Type) {
|
|||
case COFF::IMAGE_REL_BASED_HIGHADJ: return "HIGHADJ";
|
||||
case COFF::IMAGE_REL_BASED_ARM_MOV32T: return "ARM_MOV32(T)";
|
||||
case COFF::IMAGE_REL_BASED_DIR64: return "DIR64";
|
||||
default: return "unknown (" + llvm::utostr(Type) + ")";
|
||||
default: {
|
||||
static std::string Result;
|
||||
Result = "unknown (" + llvm::utostr(Type) + ")";
|
||||
return Result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue