[PATCH] D112336: [Serialization] Fix a uniqueness check
Kazu Hirata via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 22 11:17:44 PDT 2021
kazu created this revision.
kazu added a reviewer: rsmith.
kazu requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
The function is intended to maintain uniqueness of two sets -- Found
and Data. Now, we can reach the for loop shown in the patch only when
Found.empty(). This means that we never execute the body of the for
loop.
The patch fixes the problem by replacing Found with Data.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D112336
Files:
clang/lib/Serialization/ASTReaderInternals.h
Index: clang/lib/Serialization/ASTReaderInternals.h
===================================================================
--- clang/lib/Serialization/ASTReaderInternals.h
+++ clang/lib/Serialization/ASTReaderInternals.h
@@ -62,7 +62,7 @@
// Just use a linear scan unless we have more than a few IDs.
if (Found.empty() && !Data.empty()) {
if (Data.size() <= 4) {
- for (auto I : Found)
+ for (auto I : Data)
if (I == ID)
return;
Data.push_back(ID);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D112336.381608.patch
Type: text/x-patch
Size: 526 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211022/91115cf9/attachment.bin>
More information about the cfe-commits
mailing list