From 3654c6993697a30af0c5a472963fe8c03e622b98 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Sun, 26 Feb 2012 18:33:56 +0000 Subject: [PATCH] CompoundLiteralExpr: Pair a bool with a pointer. 48 -> 40 bytes on x86_64. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151496 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/AST/Expr.h | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/include/clang/AST/Expr.h b/include/clang/AST/Expr.h index 5acee7848a..61f367af61 100644 --- a/include/clang/AST/Expr.h +++ b/include/clang/AST/Expr.h @@ -2430,9 +2430,9 @@ class CompoundLiteralExpr : public Expr { /// The type as written. This can be an incomplete array type, in /// which case the actual expression type will be different. - TypeSourceInfo *TInfo; + /// The int part of the pair stores whether this expr is file scope. + llvm::PointerIntPair TInfoAndScope; Stmt *Init; - bool FileScope; public: CompoundLiteralExpr(SourceLocation lparenloc, TypeSourceInfo *tinfo, QualType T, ExprValueKind VK, Expr *init, bool fileScope) @@ -2442,7 +2442,7 @@ public: (init->isInstantiationDependent() || tinfo->getType()->isInstantiationDependentType()), init->containsUnexpandedParameterPack()), - LParenLoc(lparenloc), TInfo(tinfo), Init(init), FileScope(fileScope) {} + LParenLoc(lparenloc), TInfoAndScope(tinfo, fileScope), Init(init) {} /// \brief Construct an empty compound literal. explicit CompoundLiteralExpr(EmptyShell Empty) @@ -2452,14 +2452,18 @@ public: Expr *getInitializer() { return cast(Init); } void setInitializer(Expr *E) { Init = E; } - bool isFileScope() const { return FileScope; } - void setFileScope(bool FS) { FileScope = FS; } + bool isFileScope() const { return TInfoAndScope.getInt(); } + void setFileScope(bool FS) { TInfoAndScope.setInt(FS); } SourceLocation getLParenLoc() const { return LParenLoc; } void setLParenLoc(SourceLocation L) { LParenLoc = L; } - TypeSourceInfo *getTypeSourceInfo() const { return TInfo; } - void setTypeSourceInfo(TypeSourceInfo* tinfo) { TInfo = tinfo; } + TypeSourceInfo *getTypeSourceInfo() const { + return TInfoAndScope.getPointer(); + } + void setTypeSourceInfo(TypeSourceInfo *tinfo) { + TInfoAndScope.setPointer(tinfo); + } SourceRange getSourceRange() const { // FIXME: Init should never be null. -- 2.40.0