StandardConversionSequence FinalConversion;
};
- ~OverloadCandidate() {
- for (unsigned i = 0, e = NumConversions; i != e; ++i)
- Conversions[i].~ImplicitConversionSequence();
- }
-
/// hasAmbiguousConversion - Returns whether this overload
/// candidate requires an ambiguous conversion or not.
bool hasAmbiguousConversion() const {
// Allocator for OverloadCandidate::Conversions. We store the first few
// elements inline to avoid allocation for small sets.
- llvm::BumpPtrAllocator ConversionSequenceAllocator;
+ llvm::SpecificBumpPtrAllocator<ImplicitConversionSequence>
+ ConversionSequenceAllocator;
SourceLocation Loc;
public:
OverloadCandidateSet(SourceLocation Loc) : Loc(Loc), NumInlineSequences(0){}
- ~OverloadCandidateSet() {
- // Destroy OverloadCandidates before the allocator is destroyed.
- Candidates.clear();
- }
SourceLocation getLocation() const { return Loc; }
NumInlineSequences += NumConversions;
} else {
// Otherwise get memory from the allocator.
- C.Conversions = ConversionSequenceAllocator
- .Allocate<ImplicitConversionSequence>(NumConversions);
+ C.Conversions = ConversionSequenceAllocator.Allocate(NumConversions);
}
// Construct the new objects.
}
void OverloadCandidateSet::clear() {
+ for (unsigned i = 0, e = NumInlineSequences; i != e; ++i)
+ reinterpret_cast<ImplicitConversionSequence*>(InlineSpace)[i]
+ .~ImplicitConversionSequence();
+ NumInlineSequences = 0;
+ ConversionSequenceAllocator.DestroyAll();
Candidates.clear();
Functions.clear();
- NumInlineSequences = 0;
}
namespace {