Clearing a SmallPtrSet is still expensive, split it out from OverloadCandidateSet::clear and don't do it on destruction.

llvm-svn: 165501
This commit is contained in:
Benjamin Kramer 2012-10-09 15:52:25 +00:00
parent 2747e22051
commit 97e5949068
2 changed files with 8 additions and 2 deletions

View File

@ -751,9 +751,11 @@ namespace clang {
OverloadCandidateSet(const OverloadCandidateSet &) LLVM_DELETED_FUNCTION;
void operator=(const OverloadCandidateSet &) LLVM_DELETED_FUNCTION;
void destroyCandidates();
public:
OverloadCandidateSet(SourceLocation Loc) : Loc(Loc), NumInlineSequences(0){}
~OverloadCandidateSet() { clear(); }
~OverloadCandidateSet() { destroyCandidates(); }
SourceLocation getLocation() const { return Loc; }

View File

@ -740,13 +740,17 @@ OverloadCandidate::DeductionFailureInfo::getSecondArg() {
return 0;
}
void OverloadCandidateSet::clear() {
void OverloadCandidateSet::destroyCandidates() {
for (iterator i = begin(), e = end(); i != e; ++i) {
for (unsigned ii = 0, ie = i->NumConversions; ii != ie; ++ii)
i->Conversions[ii].~ImplicitConversionSequence();
if (!i->Viable && i->FailureKind == ovl_fail_bad_deduction)
i->DeductionFailure.Destroy();
}
}
void OverloadCandidateSet::clear() {
destroyCandidates();
NumInlineSequences = 0;
Candidates.clear();
Functions.clear();