[clang] 8d0336c - [clang-offload-bundler] Avoid repeated hash lookups (NFC) (#109507)
via cfe-commits
cfe-commits at lists.llvm.org
Sat Sep 21 09:10:53 PDT 2024
Author: Kazu Hirata
Date: 2024-09-21T09:10:49-07:00
New Revision: 8d0336c14be9d1f99e5c2b5791d8f4df35725ff2
URL: https://github.com/llvm/llvm-project/commit/8d0336c14be9d1f99e5c2b5791d8f4df35725ff2
DIFF: https://github.com/llvm/llvm-project/commit/8d0336c14be9d1f99e5c2b5791d8f4df35725ff2.diff
LOG: [clang-offload-bundler] Avoid repeated hash lookups (NFC) (#109507)
Added:
Modified:
clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp
Removed:
################################################################################
diff --git a/clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp b/clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp
index e336417586f70b..0189fe5d56ab2a 100644
--- a/clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp
+++ b/clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp
@@ -349,11 +349,10 @@ int main(int argc, const char **argv) {
// Standardize target names to include env field
std::vector<std::string> StandardizedTargetNames;
for (StringRef Target : TargetNames) {
- if (ParsedTargets.contains(Target)) {
+ if (!ParsedTargets.insert(Target).second) {
reportError(createStringError(errc::invalid_argument,
"Duplicate targets are not allowed"));
}
- ParsedTargets.insert(Target);
auto OffloadInfo = OffloadTargetInfo(Target, BundlerConfig);
bool KindIsValid = OffloadInfo.isOffloadKindValid();
More information about the cfe-commits
mailing list