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);


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);
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
  • [PATCH] D112336: [Serializat... Kazu Hirata via Phabricator via cfe-commits

Reply via email to