forked from OSchip/llvm-project
Address review feedback from r215780: Use a flag insteda of the heap. No behavior change.
llvm-svn: 226389
This commit is contained in:
parent
01fb5fb128
commit
7a92e1ad3d
|
@ -6720,12 +6720,17 @@ public:
|
||||||
|
|
||||||
class SavePendingInstantiationsAndVTableUsesRAII {
|
class SavePendingInstantiationsAndVTableUsesRAII {
|
||||||
public:
|
public:
|
||||||
SavePendingInstantiationsAndVTableUsesRAII(Sema &S): S(S) {
|
SavePendingInstantiationsAndVTableUsesRAII(Sema &S, bool Enabled)
|
||||||
|
: S(S), Enabled(Enabled) {
|
||||||
|
if (!Enabled) return;
|
||||||
|
|
||||||
SavedPendingInstantiations.swap(S.PendingInstantiations);
|
SavedPendingInstantiations.swap(S.PendingInstantiations);
|
||||||
SavedVTableUses.swap(S.VTableUses);
|
SavedVTableUses.swap(S.VTableUses);
|
||||||
}
|
}
|
||||||
|
|
||||||
~SavePendingInstantiationsAndVTableUsesRAII() {
|
~SavePendingInstantiationsAndVTableUsesRAII() {
|
||||||
|
if (!Enabled) return;
|
||||||
|
|
||||||
// Restore the set of pending vtables.
|
// Restore the set of pending vtables.
|
||||||
assert(S.VTableUses.empty() &&
|
assert(S.VTableUses.empty() &&
|
||||||
"VTableUses should be empty before it is discarded.");
|
"VTableUses should be empty before it is discarded.");
|
||||||
|
@ -6741,6 +6746,7 @@ public:
|
||||||
Sema &S;
|
Sema &S;
|
||||||
SmallVector<VTableUse, 16> SavedVTableUses;
|
SmallVector<VTableUse, 16> SavedVTableUses;
|
||||||
std::deque<PendingImplicitInstantiation> SavedPendingInstantiations;
|
std::deque<PendingImplicitInstantiation> SavedPendingInstantiations;
|
||||||
|
bool Enabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// \brief The queue of implicit template instantiations that are required
|
/// \brief The queue of implicit template instantiations that are required
|
||||||
|
|
|
@ -3313,12 +3313,8 @@ void Sema::InstantiateFunctionDefinition(SourceLocation PointOfInstantiation,
|
||||||
// it marks vtables used in late parsed templates as used.
|
// it marks vtables used in late parsed templates as used.
|
||||||
SavePendingLocalImplicitInstantiationsRAII
|
SavePendingLocalImplicitInstantiationsRAII
|
||||||
SavedPendingLocalImplicitInstantiations(*this);
|
SavedPendingLocalImplicitInstantiations(*this);
|
||||||
std::unique_ptr<SavePendingInstantiationsAndVTableUsesRAII>
|
SavePendingInstantiationsAndVTableUsesRAII
|
||||||
SavePendingInstantiationsAndVTableUses;
|
SavePendingInstantiationsAndVTableUses(*this, /*Enabled=*/Recursive);
|
||||||
if (Recursive) {
|
|
||||||
SavePendingInstantiationsAndVTableUses.reset(
|
|
||||||
new SavePendingInstantiationsAndVTableUsesRAII(*this));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Call the LateTemplateParser callback if there is a need to late parse
|
// Call the LateTemplateParser callback if there is a need to late parse
|
||||||
// a templated function definition.
|
// a templated function definition.
|
||||||
|
@ -3463,8 +3459,8 @@ void Sema::InstantiateFunctionDefinition(SourceLocation PointOfInstantiation,
|
||||||
// instantiation of this template.
|
// instantiation of this template.
|
||||||
PerformPendingInstantiations();
|
PerformPendingInstantiations();
|
||||||
|
|
||||||
// Restore PendingInstantiations and VTableUses.
|
// PendingInstantiations and VTableUses are restored through
|
||||||
SavePendingInstantiationsAndVTableUses.reset();
|
// SavePendingInstantiationsAndVTableUses's destructor.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3780,12 +3776,8 @@ void Sema::InstantiateVariableDefinition(SourceLocation PointOfInstantiation,
|
||||||
// If we're performing recursive template instantiation, create our own
|
// If we're performing recursive template instantiation, create our own
|
||||||
// queue of pending implicit instantiations that we will instantiate
|
// queue of pending implicit instantiations that we will instantiate
|
||||||
// later, while we're still within our own instantiation context.
|
// later, while we're still within our own instantiation context.
|
||||||
std::unique_ptr<SavePendingInstantiationsAndVTableUsesRAII>
|
SavePendingInstantiationsAndVTableUsesRAII
|
||||||
SavePendingInstantiationsAndVTableUses;
|
SavePendingInstantiationsAndVTableUses(*this, /*Enabled=*/Recursive);
|
||||||
if (Recursive) {
|
|
||||||
SavePendingInstantiationsAndVTableUses.reset(
|
|
||||||
new SavePendingInstantiationsAndVTableUsesRAII(*this));
|
|
||||||
}
|
|
||||||
|
|
||||||
LocalInstantiationScope Local(*this);
|
LocalInstantiationScope Local(*this);
|
||||||
|
|
||||||
|
@ -3812,8 +3804,8 @@ void Sema::InstantiateVariableDefinition(SourceLocation PointOfInstantiation,
|
||||||
// instantiation of this template.
|
// instantiation of this template.
|
||||||
PerformPendingInstantiations();
|
PerformPendingInstantiations();
|
||||||
|
|
||||||
// Restore PendingInstantiations and VTableUses.
|
// PendingInstantiations and VTableUses are restored through
|
||||||
SavePendingInstantiationsAndVTableUses.reset();
|
// SavePendingInstantiationsAndVTableUses's destructor.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3899,12 +3891,8 @@ void Sema::InstantiateVariableDefinition(SourceLocation PointOfInstantiation,
|
||||||
// while we're still within our own instantiation context.
|
// while we're still within our own instantiation context.
|
||||||
SavePendingLocalImplicitInstantiationsRAII
|
SavePendingLocalImplicitInstantiationsRAII
|
||||||
SavedPendingLocalImplicitInstantiations(*this);
|
SavedPendingLocalImplicitInstantiations(*this);
|
||||||
std::unique_ptr<SavePendingInstantiationsAndVTableUsesRAII>
|
SavePendingInstantiationsAndVTableUsesRAII
|
||||||
SavePendingInstantiationsAndVTableUses;
|
SavePendingInstantiationsAndVTableUses(*this, /*Enabled=*/Recursive);
|
||||||
if (Recursive) {
|
|
||||||
SavePendingInstantiationsAndVTableUses.reset(
|
|
||||||
new SavePendingInstantiationsAndVTableUsesRAII(*this));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Enter the scope of this instantiation. We don't use
|
// Enter the scope of this instantiation. We don't use
|
||||||
// PushDeclContext because we don't have a scope.
|
// PushDeclContext because we don't have a scope.
|
||||||
|
@ -3970,8 +3958,8 @@ void Sema::InstantiateVariableDefinition(SourceLocation PointOfInstantiation,
|
||||||
// instantiation of this template.
|
// instantiation of this template.
|
||||||
PerformPendingInstantiations();
|
PerformPendingInstantiations();
|
||||||
|
|
||||||
// Restore PendingInstantiations and VTableUses.
|
// PendingInstantiations and VTableUses are restored through
|
||||||
SavePendingInstantiationsAndVTableUses.reset();
|
// SavePendingInstantiationsAndVTableUses's destructor.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue