]> granicus.if.org Git - clang/commitdiff
Clearing a SmallPtrSet is still expensive, split it out from OverloadCandidateSet...
authorBenjamin Kramer <benny.kra@googlemail.com>
Tue, 9 Oct 2012 15:52:25 +0000 (15:52 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Tue, 9 Oct 2012 15:52:25 +0000 (15:52 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165501 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Sema/Overload.h
lib/Sema/SemaOverload.cpp

index 6ebccbdba638d3ff39a7a77a3e779b25f6c14ccb..65ed781f743c434c3ea3e5554adc985d23e28bf0 100644 (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; }
 
index 600393137d729f63569f9e055c9515b9102740e1..bdc25ba39c2c9b33704c020da6f6979846957c86 100644 (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();