зеркало из https://github.com/microsoft/clang-1.git
Remove the NameQualifier struct, which was just a wrapper around
NestedNameSpecifierLoc. It predates when we had such an object. Reference the NNSLoc directly in DREs, and embed it directly into the MemberNameQualifier struct. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130668 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
7e740bd367
Коммит
6857c3e12c
|
@ -630,14 +630,6 @@ public:
|
|||
static bool classof(const OpaqueValueExpr *) { return true; }
|
||||
};
|
||||
|
||||
/// \brief Represents the qualifier that may precede a C++ name, e.g., the
|
||||
/// "std::" in "std::sort".
|
||||
struct NameQualifier {
|
||||
/// \brief The nested-name-specifier that qualifies the name, including
|
||||
/// source-location information.
|
||||
NestedNameSpecifierLoc QualifierLoc;
|
||||
};
|
||||
|
||||
/// \brief Represents an explicit template argument list in C++, e.g.,
|
||||
/// the "<int>" in "sort<int>".
|
||||
struct ExplicitTemplateArgumentList {
|
||||
|
@ -697,15 +689,15 @@ class DeclRefExpr : public Expr {
|
|||
/// embedded in D.
|
||||
DeclarationNameLoc DNLoc;
|
||||
|
||||
/// \brief Helper to retrieve the optional NameQualifier.
|
||||
NameQualifier &getNameQualifier() {
|
||||
/// \brief Helper to retrieve the optional NestedNameSpecifierLoc.
|
||||
NestedNameSpecifierLoc &getInternalQualifierLoc() {
|
||||
assert(hasQualifier());
|
||||
return *reinterpret_cast<NameQualifier *>(this + 1);
|
||||
return *reinterpret_cast<NestedNameSpecifierLoc *>(this + 1);
|
||||
}
|
||||
|
||||
/// \brief Helper to retrieve the optional NameQualifier.
|
||||
const NameQualifier &getNameQualifier() const {
|
||||
return const_cast<DeclRefExpr *>(this)->getNameQualifier();
|
||||
/// \brief Helper to retrieve the optional NestedNameSpecifierLoc.
|
||||
const NestedNameSpecifierLoc &getInternalQualifierLoc() const {
|
||||
return const_cast<DeclRefExpr *>(this)->getInternalQualifierLoc();
|
||||
}
|
||||
|
||||
DeclRefExpr(NestedNameSpecifierLoc QualifierLoc,
|
||||
|
@ -777,7 +769,7 @@ public:
|
|||
if (!hasQualifier())
|
||||
return 0;
|
||||
|
||||
return getNameQualifier().QualifierLoc.getNestedNameSpecifier();
|
||||
return getInternalQualifierLoc().getNestedNameSpecifier();
|
||||
}
|
||||
|
||||
/// \brief If the name was qualified, retrieves the nested-name-specifier
|
||||
|
@ -786,7 +778,7 @@ public:
|
|||
if (!hasQualifier())
|
||||
return NestedNameSpecifierLoc();
|
||||
|
||||
return getNameQualifier().QualifierLoc;
|
||||
return getInternalQualifierLoc();
|
||||
}
|
||||
|
||||
/// \brief Determines whether this declaration reference was followed by an
|
||||
|
@ -803,7 +795,7 @@ public:
|
|||
return *reinterpret_cast<ExplicitTemplateArgumentList *>(this + 1);
|
||||
|
||||
return *reinterpret_cast<ExplicitTemplateArgumentList *>(
|
||||
&getNameQualifier() + 1);
|
||||
&getInternalQualifierLoc() + 1);
|
||||
}
|
||||
|
||||
/// \brief Retrieve the explicit template argument list that followed the
|
||||
|
@ -1879,7 +1871,13 @@ public:
|
|||
///
|
||||
class MemberExpr : public Expr {
|
||||
/// Extra data stored in some member expressions.
|
||||
struct MemberNameQualifier : public NameQualifier {
|
||||
struct MemberNameQualifier {
|
||||
/// \brief The nested-name-specifier that qualifies the name, including
|
||||
/// source-location information.
|
||||
NestedNameSpecifierLoc QualifierLoc;
|
||||
|
||||
/// \brief The DeclAccessPair through which the MemberDecl was found due to
|
||||
/// name qualifiers.
|
||||
DeclAccessPair FoundDecl;
|
||||
};
|
||||
|
||||
|
|
|
@ -282,7 +282,7 @@ DeclRefExpr::DeclRefExpr(NestedNameSpecifierLoc QualifierLoc,
|
|||
D(D), Loc(NameLoc) {
|
||||
DeclRefExprBits.HasQualifier = QualifierLoc ? 1 : 0;
|
||||
if (QualifierLoc)
|
||||
getNameQualifier().QualifierLoc = QualifierLoc;
|
||||
getInternalQualifierLoc() = QualifierLoc;
|
||||
|
||||
DeclRefExprBits.HasExplicitTemplateArgs = TemplateArgs ? 1 : 0;
|
||||
if (TemplateArgs) {
|
||||
|
@ -300,7 +300,7 @@ DeclRefExpr::DeclRefExpr(NestedNameSpecifierLoc QualifierLoc,
|
|||
D(D), Loc(NameInfo.getLoc()), DNLoc(NameInfo.getInfo()) {
|
||||
DeclRefExprBits.HasQualifier = QualifierLoc ? 1 : 0;
|
||||
if (QualifierLoc)
|
||||
getNameQualifier().QualifierLoc = QualifierLoc;
|
||||
getInternalQualifierLoc() = QualifierLoc;
|
||||
|
||||
DeclRefExprBits.HasExplicitTemplateArgs = TemplateArgs ? 1 : 0;
|
||||
if (TemplateArgs)
|
||||
|
@ -330,7 +330,7 @@ DeclRefExpr *DeclRefExpr::Create(ASTContext &Context,
|
|||
const TemplateArgumentListInfo *TemplateArgs) {
|
||||
std::size_t Size = sizeof(DeclRefExpr);
|
||||
if (QualifierLoc != 0)
|
||||
Size += sizeof(NameQualifier);
|
||||
Size += sizeof(NestedNameSpecifierLoc);
|
||||
|
||||
if (TemplateArgs)
|
||||
Size += ExplicitTemplateArgumentList::sizeFor(*TemplateArgs);
|
||||
|
@ -345,7 +345,7 @@ DeclRefExpr *DeclRefExpr::CreateEmpty(ASTContext &Context,
|
|||
unsigned NumTemplateArgs) {
|
||||
std::size_t Size = sizeof(DeclRefExpr);
|
||||
if (HasQualifier)
|
||||
Size += sizeof(NameQualifier);
|
||||
Size += sizeof(NestedNameSpecifierLoc);
|
||||
|
||||
if (HasExplicitTemplateArgs)
|
||||
Size += ExplicitTemplateArgumentList::sizeFor(NumTemplateArgs);
|
||||
|
|
|
@ -432,7 +432,7 @@ void ASTStmtReader::VisitDeclRefExpr(DeclRefExpr *E) {
|
|||
NumTemplateArgs = Record[Idx++];
|
||||
|
||||
if (E->hasQualifier())
|
||||
E->getNameQualifier().QualifierLoc
|
||||
E->getInternalQualifierLoc()
|
||||
= Reader.ReadNestedNameSpecifierLoc(F, Record, Idx);
|
||||
|
||||
if (E->hasExplicitTemplateArgs())
|
||||
|
|
Загрузка…
Ссылка в новой задаче