[PATCH] D92010: [clang-offload-bundler] use std::forward_list for storing temp file names [NFC]
Sergey Dmitriev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 24 01:08:30 PST 2020
sdmitriev created this revision.
sdmitriev added a reviewer: ABataev.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
sdmitriev requested review of this revision.
Use a different container that preserves existing elements on modification
for storing temporary file names. Current container can make StringRefs
returned earlier invalid on reallocation.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D92010
Files:
clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp
Index: clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp
===================================================================
--- clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp
+++ clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp
@@ -41,6 +41,7 @@
#include <cassert>
#include <cstddef>
#include <cstdint>
+#include <forward_list>
#include <memory>
#include <string>
#include <system_error>
@@ -394,7 +395,7 @@
if (std::error_code EC =
sys::fs::createTemporaryFile("clang-offload-bundler", "tmp", File))
return createFileError(File, EC);
- Files.push_back(File);
+ Files.push_front(File);
if (Contents) {
std::error_code EC;
@@ -403,11 +404,11 @@
return createFileError(File, EC);
OS.write(Contents->data(), Contents->size());
}
- return Files.back();
+ return Files.front();
}
private:
- SmallVector<SmallString<128u>, 4u> Files;
+ std::forward_list<SmallString<128u>> Files;
};
} // end anonymous namespace
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92010.307270.patch
Type: text/x-patch
Size: 1025 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201124/f44e5a9a/attachment-0001.bin>
More information about the cfe-commits
mailing list