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
diff --git a/lib/Serialization/ASTReaderStmt.cpp b/lib/Serialization/ASTReaderStmt.cpp
index 83b3907..f0b5aba 100644
--- a/lib/Serialization/ASTReaderStmt.cpp
+++ b/lib/Serialization/ASTReaderStmt.cpp
@@ -425,21 +425,17 @@
void ASTStmtReader::VisitDeclRefExpr(DeclRefExpr *E) {
VisitExpr(E);
- bool HasQualifier = Record[Idx++];
- bool HasExplicitTemplateArgs = Record[Idx++];
+ E->DeclRefExprBits.HasQualifier = Record[Idx++];
+ E->DeclRefExprBits.HasExplicitTemplateArgs = Record[Idx++];
unsigned NumTemplateArgs = 0;
- if (HasExplicitTemplateArgs)
+ if (E->hasExplicitTemplateArgs())
NumTemplateArgs = Record[Idx++];
- E->DecoratedD.setInt((HasQualifier? DeclRefExpr::HasQualifierFlag : 0) |
- (HasExplicitTemplateArgs
- ? DeclRefExpr::HasExplicitTemplateArgumentListFlag : 0));
-
- if (HasQualifier)
+ if (E->hasQualifier())
E->getNameQualifier()->QualifierLoc
= Reader.ReadNestedNameSpecifierLoc(F, Record, Idx);
- if (HasExplicitTemplateArgs)
+ if (E->hasExplicitTemplateArgs())
ReadExplicitTemplateArgumentList(E->getExplicitTemplateArgs(),
NumTemplateArgs);