зеркало из https://github.com/microsoft/clang-1.git
Clear ImplicitConversionSequence the obvious way which turns out to be less fragile.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148200 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
314f5544fb
Коммит
9e2822bb4a
|
@ -691,8 +691,7 @@ namespace clang {
|
|||
|
||||
// Allocator for OverloadCandidate::Conversions. We store the first few
|
||||
// elements inline to avoid allocation for small sets.
|
||||
llvm::SpecificBumpPtrAllocator<ImplicitConversionSequence>
|
||||
ConversionSequenceAllocator;
|
||||
llvm::BumpPtrAllocator ConversionSequenceAllocator;
|
||||
|
||||
SourceLocation Loc;
|
||||
|
||||
|
@ -704,6 +703,11 @@ namespace clang {
|
|||
|
||||
public:
|
||||
OverloadCandidateSet(SourceLocation Loc) : Loc(Loc), NumInlineSequences(0){}
|
||||
~OverloadCandidateSet() {
|
||||
for (iterator i = begin(), e = end(); i != e; ++i)
|
||||
for (unsigned ii = 0, ie = i->NumConversions; ii != ie; ++ii)
|
||||
i->Conversions[ii].~ImplicitConversionSequence();
|
||||
}
|
||||
|
||||
SourceLocation getLocation() const { return Loc; }
|
||||
|
||||
|
@ -738,7 +742,8 @@ namespace clang {
|
|||
NumInlineSequences += NumConversions;
|
||||
} else {
|
||||
// Otherwise get memory from the allocator.
|
||||
C.Conversions = ConversionSequenceAllocator.Allocate(NumConversions);
|
||||
C.Conversions = ConversionSequenceAllocator
|
||||
.Allocate<ImplicitConversionSequence>(NumConversions);
|
||||
}
|
||||
|
||||
// Construct the new objects.
|
||||
|
|
|
@ -541,11 +541,10 @@ OverloadCandidate::DeductionFailureInfo::getSecondArg() {
|
|||
}
|
||||
|
||||
void OverloadCandidateSet::clear() {
|
||||
for (unsigned i = 0, e = NumInlineSequences; i != e; ++i)
|
||||
reinterpret_cast<ImplicitConversionSequence*>(InlineSpace)[i]
|
||||
.~ImplicitConversionSequence();
|
||||
for (iterator i = begin(), e = end(); i != e; ++i)
|
||||
for (unsigned ii = 0, ie = i->NumConversions; ii != ie; ++ii)
|
||||
i->Conversions[ii].~ImplicitConversionSequence();
|
||||
NumInlineSequences = 0;
|
||||
ConversionSequenceAllocator.DestroyAll();
|
||||
Candidates.clear();
|
||||
Functions.clear();
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче