diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2011-05-01 21:29:53 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2011-05-01 21:29:53 +0000 |
commit | cb66cff8fdf641f57f85dedb515a5f3240e3a9bb (patch) | |
tree | bbfba4c9dcad604a3bf11852007fe53bbad14ed0 /lib/AST/Expr.cpp | |
parent | 5d65e34b08b3e57a4da834195757d0d15baaffd0 (diff) |
Move the state bits in DeclRefExpr out of the pointer union and into
a bitfield in the base class. DREs weren't using any bits here past the
normal Expr bits, so we have plenty of room. This makes the common case
of getting a Decl out of a DRE no longer need to do any masking etc.
Also, while here, clean up code to use the accessor methods rather than
directly poking these bits, and provide a nice comment for DREs that
includes the information previously attached to the bits going into the
pointer union.
No functionality changed here, but DREs should be a tad faster now.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130666 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/Expr.cpp')
-rw-r--r-- | lib/AST/Expr.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp index 2a5917c459..cd5a63aab5 100644 --- a/lib/AST/Expr.cpp +++ b/lib/AST/Expr.cpp @@ -279,17 +279,18 @@ DeclRefExpr::DeclRefExpr(NestedNameSpecifierLoc QualifierLoc, const TemplateArgumentListInfo *TemplateArgs, QualType T, ExprValueKind VK) : Expr(DeclRefExprClass, T, VK, OK_Ordinary, false, false, false), - DecoratedD(D, - (QualifierLoc? HasQualifierFlag : 0) | - (TemplateArgs ? HasExplicitTemplateArgumentListFlag : 0)), - Loc(NameLoc) { + D(D), Loc(NameLoc) { + DeclRefExprBits.HasQualifier = QualifierLoc ? 1 : 0; if (QualifierLoc) { + DeclRefExprBits.HasQualifier = 1; NameQualifier *NQ = getNameQualifier(); NQ->QualifierLoc = QualifierLoc; } - - if (TemplateArgs) + + DeclRefExprBits.HasExplicitTemplateArgs = TemplateArgs ? 1 : 0; + if (TemplateArgs) { getExplicitTemplateArgs().initializeFrom(*TemplateArgs); + } computeDependence(); } @@ -299,15 +300,14 @@ DeclRefExpr::DeclRefExpr(NestedNameSpecifierLoc QualifierLoc, const TemplateArgumentListInfo *TemplateArgs, QualType T, ExprValueKind VK) : Expr(DeclRefExprClass, T, VK, OK_Ordinary, false, false, false), - DecoratedD(D, - (QualifierLoc? HasQualifierFlag : 0) | - (TemplateArgs ? HasExplicitTemplateArgumentListFlag : 0)), - Loc(NameInfo.getLoc()), DNLoc(NameInfo.getInfo()) { + D(D), Loc(NameInfo.getLoc()), DNLoc(NameInfo.getInfo()) { + DeclRefExprBits.HasQualifier = QualifierLoc ? 1 : 0; if (QualifierLoc) { NameQualifier *NQ = getNameQualifier(); NQ->QualifierLoc = QualifierLoc; } + DeclRefExprBits.HasExplicitTemplateArgs = TemplateArgs ? 1 : 0; if (TemplateArgs) getExplicitTemplateArgs().initializeFrom(*TemplateArgs); |