Skip to content

Commit 97e5949

Browse files
committed
Clearing a SmallPtrSet is still expensive, split it out from OverloadCandidateSet::clear and don't do it on destruction.
llvm-svn: 165501
1 parent 2747e22 commit 97e5949

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

clang/include/clang/Sema/Overload.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -751,9 +751,11 @@ namespace clang {
751751
OverloadCandidateSet(const OverloadCandidateSet &) LLVM_DELETED_FUNCTION;
752752
void operator=(const OverloadCandidateSet &) LLVM_DELETED_FUNCTION;
753753

754+
void destroyCandidates();
755+
754756
public:
755757
OverloadCandidateSet(SourceLocation Loc) : Loc(Loc), NumInlineSequences(0){}
756-
~OverloadCandidateSet() { clear(); }
758+
~OverloadCandidateSet() { destroyCandidates(); }
757759

758760
SourceLocation getLocation() const { return Loc; }
759761

clang/lib/Sema/SemaOverload.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -740,13 +740,17 @@ OverloadCandidate::DeductionFailureInfo::getSecondArg() {
740740
return 0;
741741
}
742742

743-
void OverloadCandidateSet::clear() {
743+
void OverloadCandidateSet::destroyCandidates() {
744744
for (iterator i = begin(), e = end(); i != e; ++i) {
745745
for (unsigned ii = 0, ie = i->NumConversions; ii != ie; ++ii)
746746
i->Conversions[ii].~ImplicitConversionSequence();
747747
if (!i->Viable && i->FailureKind == ovl_fail_bad_deduction)
748748
i->DeductionFailure.Destroy();
749749
}
750+
}
751+
752+
void OverloadCandidateSet::clear() {
753+
destroyCandidates();
750754
NumInlineSequences = 0;
751755
Candidates.clear();
752756
Functions.clear();

0 commit comments

Comments
 (0)