зеркало из https://github.com/microsoft/clang-1.git
Compress storage for MemberSpecializationInfo into a single
pointer. Yay, PointerIntPair. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83512 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
63e5e64a49
Коммит
44e368b6a8
|
@ -552,26 +552,32 @@ public:
|
|||
/// template, which may be a member function, static data member, or
|
||||
/// member class.
|
||||
class MemberSpecializationInfo {
|
||||
NamedDecl *InstantiatedFrom;
|
||||
TemplateSpecializationKind TSK;
|
||||
// The member declaration from which this member was instantiated, and the
|
||||
// manner in which the instantiation occurred (in the lower two bits).
|
||||
llvm::PointerIntPair<NamedDecl *, 2> MemberAndTSK;
|
||||
|
||||
public:
|
||||
explicit
|
||||
MemberSpecializationInfo(NamedDecl *IF, TemplateSpecializationKind TSK)
|
||||
: InstantiatedFrom(IF), TSK(TSK) { }
|
||||
: MemberAndTSK(IF, TSK - 1) {
|
||||
assert(TSK != TSK_Undeclared &&
|
||||
"Cannot encode undeclared template specializations for members");
|
||||
}
|
||||
|
||||
/// \brief Retrieve the member declaration from which this member was
|
||||
/// instantiated.
|
||||
NamedDecl *getInstantiatedFrom() const { return InstantiatedFrom; }
|
||||
NamedDecl *getInstantiatedFrom() const { return MemberAndTSK.getPointer(); }
|
||||
|
||||
/// \brief Determine what kind of template specialization this is.
|
||||
TemplateSpecializationKind getTemplateSpecializationKind() const {
|
||||
return TSK;
|
||||
return (TemplateSpecializationKind)(MemberAndTSK.getInt() + 1);
|
||||
}
|
||||
|
||||
/// \brief Set the template specialization kind.
|
||||
void setTemplateSpecializationKind(TemplateSpecializationKind TSK) {
|
||||
this->TSK = TSK;
|
||||
assert(TSK != TSK_Undeclared &&
|
||||
"Cannot encode undeclared template specializations for members");
|
||||
MemberAndTSK.setInt(TSK - 1);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче