Author: Chuanqi Xu
Date: 2026-03-18T09:02:24Z
New Revision: a8ff7e13c3beadfa2f5f35dd793c5bd0ae2e24e8

URL: 
https://github.com/llvm/llvm-project/commit/a8ff7e13c3beadfa2f5f35dd793c5bd0ae2e24e8
DIFF: 
https://github.com/llvm/llvm-project/commit/a8ff7e13c3beadfa2f5f35dd793c5bd0ae2e24e8.diff

LOG: [NFCI] [Serialization] Deduplicate DeclID properly (#187212)

In the original code, the operation to iterate Found is meaningless, as
it is guarded by Found.empty(). So this is always a noop for 10 years.

According to the context, I believe the intention is to avoid duplicated
DeclID to be in Data. So changing iterating Found to Data.

Just found by looking around the code.

This is not strictly NFC but NFC intentionally. I will be surprised if
this breaks anything.

Added: 
    

Modified: 
    clang/lib/Serialization/ASTReaderInternals.h

Removed: 
    


################################################################################
diff  --git a/clang/lib/Serialization/ASTReaderInternals.h 
b/clang/lib/Serialization/ASTReaderInternals.h
index 4a7794889b039..a132d01a21128 100644
--- a/clang/lib/Serialization/ASTReaderInternals.h
+++ b/clang/lib/Serialization/ASTReaderInternals.h
@@ -61,7 +61,7 @@ class ASTDeclContextNameLookupTraitBase {
       // 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);
@@ -183,7 +183,7 @@ class LazySpecializationInfoLookupTrait {
       // 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 == Info)
               return;
           Data.push_back(Info);


        
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to