StmtIterator: Put stmt and decl group pointer into a union.

Reduce the size of StmtIterator without changing behavior.

llvm-svn: 241356
This commit is contained in:
Benjamin Kramer 2015-07-03 15:12:36 +00:00
parent 973431b22f
commit bfc8413fdb
2 changed files with 8 additions and 6 deletions

View File

@ -32,8 +32,10 @@ protected:
enum { StmtMode = 0x0, SizeOfTypeVAMode = 0x1, DeclGroupMode = 0x2,
Flags = 0x3 };
Stmt **stmt;
Decl **DGI;
union {
Stmt **stmt;
Decl **DGI;
};
uintptr_t RawVAPtr;
Decl **DGE;
@ -64,10 +66,10 @@ protected:
Stmt*& GetDeclExpr() const;
StmtIteratorBase(Stmt **s) : stmt(s), DGI(nullptr), RawVAPtr(0) {}
StmtIteratorBase(Stmt **s) : stmt(s), RawVAPtr(0) {}
StmtIteratorBase(const VariableArrayType *t);
StmtIteratorBase(Decl **dgi, Decl **dge);
StmtIteratorBase() : stmt(nullptr), DGI(nullptr), RawVAPtr(0) {}
StmtIteratorBase() : stmt(nullptr), RawVAPtr(0) {}
};

View File

@ -93,12 +93,12 @@ bool StmtIteratorBase::HandleDecl(Decl* D) {
}
StmtIteratorBase::StmtIteratorBase(Decl** dgi, Decl** dge)
: stmt(nullptr), DGI(dgi), RawVAPtr(DeclGroupMode), DGE(dge) {
: DGI(dgi), RawVAPtr(DeclGroupMode), DGE(dge) {
NextDecl(false);
}
StmtIteratorBase::StmtIteratorBase(const VariableArrayType* t)
: stmt(nullptr), DGI(nullptr), RawVAPtr(SizeOfTypeVAMode) {
: DGI(nullptr), RawVAPtr(SizeOfTypeVAMode) {
RawVAPtr |= reinterpret_cast<uintptr_t>(t);
}