r241356 - StmtIterator: Put stmt and decl group pointer into a union.
Benjamin Kramer
benny.kra at googlemail.com
Fri Jul 3 08:12:36 PDT 2015
Author: d0k
Date: Fri Jul 3 10:12:36 2015
New Revision: 241356
URL: http://llvm.org/viewvc/llvm-project?rev=241356&view=rev
Log:
StmtIterator: Put stmt and decl group pointer into a union.
Reduce the size of StmtIterator without changing behavior.
Modified:
cfe/trunk/include/clang/AST/StmtIterator.h
cfe/trunk/lib/AST/StmtIterator.cpp
Modified: cfe/trunk/include/clang/AST/StmtIterator.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/StmtIterator.h?rev=241356&r1=241355&r2=241356&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/StmtIterator.h (original)
+++ cfe/trunk/include/clang/AST/StmtIterator.h Fri Jul 3 10:12:36 2015
@@ -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) {}
};
Modified: cfe/trunk/lib/AST/StmtIterator.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtIterator.cpp?rev=241356&r1=241355&r2=241356&view=diff
==============================================================================
--- cfe/trunk/lib/AST/StmtIterator.cpp (original)
+++ cfe/trunk/lib/AST/StmtIterator.cpp Fri Jul 3 10:12:36 2015
@@ -93,12 +93,12 @@ bool StmtIteratorBase::HandleDecl(Decl*
}
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);
}
More information about the cfe-commits
mailing list