[clang] 3110060 - AST: Avoid using SmallVector::set_size() in UnresolvedSet

Duncan P. N. Exon Smith via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 11 17:48:11 PST 2022


Author: Duncan P. N. Exon Smith
Date: 2022-01-11T17:47:23-08:00
New Revision: 3110060bc721a02e69ead4c56e037a03d31bedef

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

LOG: AST: Avoid using SmallVector::set_size() in UnresolvedSet

Update UnresolvedSet to use (and expose) `SmallVector::truncate()` instead
of `SmallVector::set_size()`. The latter is going to made private in a
future commit to avoid misuse.

Differential Revision: https://reviews.llvm.org/D115386

Added: 
    

Modified: 
    clang/include/clang/AST/UnresolvedSet.h
    clang/lib/Sema/SemaLookup.cpp

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/AST/UnresolvedSet.h b/clang/include/clang/AST/UnresolvedSet.h
index c75aa0785a63a..17b47f6ab96be 100644
--- a/clang/include/clang/AST/UnresolvedSet.h
+++ b/clang/include/clang/AST/UnresolvedSet.h
@@ -121,7 +121,7 @@ class UnresolvedSetImpl {
   void setAccess(iterator I, AccessSpecifier AS) { I.I->setAccess(AS); }
 
   void clear() { decls().clear(); }
-  void set_size(unsigned N) { decls().set_size(N); }
+  void truncate(unsigned N) { decls().truncate(N); }
 
   bool empty() const { return decls().empty(); }
   unsigned size() const { return decls().size(); }

diff  --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp
index c905a10990d21..af6ee24240ceb 100644
--- a/clang/lib/Sema/SemaLookup.cpp
+++ b/clang/lib/Sema/SemaLookup.cpp
@@ -620,7 +620,7 @@ void LookupResult::resolveKind() {
     getSema().diagnoseEquivalentInternalLinkageDeclarations(
         getNameLoc(), HasNonFunction, EquivalentNonFunctions);
 
-  Decls.set_size(N);
+  Decls.truncate(N);
 
   if (HasNonFunction && (HasFunction || HasUnresolved))
     Ambiguous = true;


        


More information about the cfe-commits mailing list