dexonsmith created this revision. dexonsmith added a reviewer: dblaikie. dexonsmith requested review of this revision. Herald added a project: clang.
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. Currently depends on https://reviews.llvm.org/D115383. It seems to improve readability to use `truncate()` instead of `resize()` (known to shrink the size), and it keeps an assertion in place (not sure of value?) that this doesn't grow. I can't imagine the former's performance characteristics are important here, so I could be convinced to just use `resize()`... Blocker for https://reviews.llvm.org/D115380. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D115386 Files: clang/include/clang/AST/UnresolvedSet.h clang/lib/Sema/SemaLookup.cpp Index: clang/lib/Sema/SemaLookup.cpp =================================================================== --- clang/lib/Sema/SemaLookup.cpp +++ clang/lib/Sema/SemaLookup.cpp @@ -620,7 +620,7 @@ getSema().diagnoseEquivalentInternalLinkageDeclarations( getNameLoc(), HasNonFunction, EquivalentNonFunctions); - Decls.set_size(N); + Decls.truncate(N); if (HasNonFunction && (HasFunction || HasUnresolved)) Ambiguous = true; Index: clang/include/clang/AST/UnresolvedSet.h =================================================================== --- clang/include/clang/AST/UnresolvedSet.h +++ clang/include/clang/AST/UnresolvedSet.h @@ -121,7 +121,7 @@ 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(); }
Index: clang/lib/Sema/SemaLookup.cpp =================================================================== --- clang/lib/Sema/SemaLookup.cpp +++ clang/lib/Sema/SemaLookup.cpp @@ -620,7 +620,7 @@ getSema().diagnoseEquivalentInternalLinkageDeclarations( getNameLoc(), HasNonFunction, EquivalentNonFunctions); - Decls.set_size(N); + Decls.truncate(N); if (HasNonFunction && (HasFunction || HasUnresolved)) Ambiguous = true; Index: clang/include/clang/AST/UnresolvedSet.h =================================================================== --- clang/include/clang/AST/UnresolvedSet.h +++ clang/include/clang/AST/UnresolvedSet.h @@ -121,7 +121,7 @@ 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(); }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits