summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-10-08 00:19:07 +0000
committerDouglas Gregor <dgregor@apple.com>2009-10-08 00:19:07 +0000
commitf43472bd84f68effa79565b5223360e234497132 (patch)
tree63ad8d1a5dcf5bf9715f74f73fa48fe6c6137967
parente3dfd4826b6ae3b37527d0fb4a1bc41abd090423 (diff)
downloadbcm5719-llvm-f43472bd84f68effa79565b5223360e234497132.tar.gz
bcm5719-llvm-f43472bd84f68effa79565b5223360e234497132.zip
Compress storage for MemberSpecializationInfo into a single
pointer. Yay, PointerIntPair. llvm-svn: 83512
-rw-r--r--clang/include/clang/AST/DeclTemplate.h18
1 files changed, 12 insertions, 6 deletions
diff --git a/clang/include/clang/AST/DeclTemplate.h b/clang/include/clang/AST/DeclTemplate.h
index 3f6f782c29e..f49aeccb46e 100644
--- a/clang/include/clang/AST/DeclTemplate.h
+++ b/clang/include/clang/AST/DeclTemplate.h
@@ -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);
}
};
OpenPOWER on IntegriCloud