[cfe-commits] r89402 - in /cfe/trunk: include/clang/AST/ExprCXX.h include/clang/AST/StmtNodes.def lib/AST/Expr.cpp lib/AST/ExprCXX.cpp lib/AST/StmtPrinter.cpp lib/AST/StmtProfile.cpp lib/CodeGen/Mangle.cpp lib/Sema/SemaExpr.cpp lib/Sema/SemaTemplate.cpp lib/Sema/TreeTransform.h
John McCall
rjmccall at apple.com
Thu Nov 19 14:55:06 PST 2009
Author: rjmccall
Date: Thu Nov 19 16:55:06 2009
New Revision: 89402
URL: http://llvm.org/viewvc/llvm-project?rev=89402&view=rev
Log:
Draw a brighter line between "unresolved" expressions, where we have done the
appropriate lookup and simply can't resolve the referrent yet, and
"dependent scope" expressions, where we can't do the lookup yet because the
entity we need to look into is a dependent type.
Modified:
cfe/trunk/include/clang/AST/ExprCXX.h
cfe/trunk/include/clang/AST/StmtNodes.def
cfe/trunk/lib/AST/Expr.cpp
cfe/trunk/lib/AST/ExprCXX.cpp
cfe/trunk/lib/AST/StmtPrinter.cpp
cfe/trunk/lib/AST/StmtProfile.cpp
cfe/trunk/lib/CodeGen/Mangle.cpp
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/lib/Sema/SemaTemplate.cpp
cfe/trunk/lib/Sema/TreeTransform.h
Modified: cfe/trunk/include/clang/AST/ExprCXX.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ExprCXX.h?rev=89402&r1=89401&r2=89402&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/ExprCXX.h (original)
+++ cfe/trunk/include/clang/AST/ExprCXX.h Thu Nov 19 16:55:06 2009
@@ -1066,18 +1066,18 @@
/// \brief A qualified reference to a name whose declaration cannot
/// yet be resolved.
///
-/// UnresolvedDeclRefExpr is similar to eclRefExpr in that
+/// DependentScopeDeclRefExpr is similar to eclRefExpr in that
/// it expresses a reference to a declaration such as
/// X<T>::value. The difference, however, is that an
-/// UnresolvedDeclRefExpr node is used only within C++ templates when
+/// DependentScopeDeclRefExpr node is used only within C++ templates when
/// the qualification (e.g., X<T>::) refers to a dependent type. In
/// this case, X<T>::value cannot resolve to a declaration because the
/// declaration will differ from on instantiation of X<T> to the
-/// next. Therefore, UnresolvedDeclRefExpr keeps track of the
+/// next. Therefore, DependentScopeDeclRefExpr keeps track of the
/// qualifier (X<T>::) and the name of the entity being referenced
/// ("value"). Such expressions will instantiate to a DeclRefExpr once the
/// declaration can be found.
-class UnresolvedDeclRefExpr : public Expr {
+class DependentScopeDeclRefExpr : public Expr {
/// The name of the entity we will be referencing.
DeclarationName Name;
@@ -1097,10 +1097,10 @@
bool IsAddressOfOperand;
public:
- UnresolvedDeclRefExpr(DeclarationName N, QualType T, SourceLocation L,
- SourceRange R, NestedNameSpecifier *NNS,
- bool IsAddressOfOperand)
- : Expr(UnresolvedDeclRefExprClass, T, true, true),
+ DependentScopeDeclRefExpr(DeclarationName N, QualType T, SourceLocation L,
+ SourceRange R, NestedNameSpecifier *NNS,
+ bool IsAddressOfOperand)
+ : Expr(DependentScopeDeclRefExprClass, T, true, true),
Name(N), Loc(L), QualifierRange(R), NNS(NNS),
IsAddressOfOperand(IsAddressOfOperand) { }
@@ -1125,9 +1125,9 @@
}
static bool classof(const Stmt *T) {
- return T->getStmtClass() == UnresolvedDeclRefExprClass;
+ return T->getStmtClass() == DependentScopeDeclRefExprClass;
}
- static bool classof(const UnresolvedDeclRefExpr *) { return true; }
+ static bool classof(const DependentScopeDeclRefExpr *) { return true; }
virtual StmtIterator child_begin();
virtual StmtIterator child_end();
@@ -1380,7 +1380,7 @@
/// \brief Represents a C++ member access expression where the actual member
/// referenced could not be resolved, e.g., because the base expression or the
/// member name was dependent.
-class CXXUnresolvedMemberExpr : public Expr {
+class CXXDependentScopeMemberExpr : public Expr {
/// \brief The expression for the base pointer or class reference,
/// e.g., the \c x in x.f.
Stmt *Base;
@@ -1408,7 +1408,7 @@
///
/// FIXME: This member, along with the Qualifier and QualifierRange, could
/// be stuck into a structure that is optionally allocated at the end of
- /// the CXXUnresolvedMemberExpr, to save space in the common case.
+ /// the CXXDependentScopeMemberExpr, to save space in the common case.
NamedDecl *FirstQualifierFoundInScope;
/// \brief The member to which this member expression refers, which
@@ -1431,11 +1431,11 @@
/// \brief Retrieve the explicit template argument list that followed the
/// member template name, if any.
const ExplicitTemplateArgumentList *getExplicitTemplateArgumentList() const {
- return const_cast<CXXUnresolvedMemberExpr *>(this)
+ return const_cast<CXXDependentScopeMemberExpr *>(this)
->getExplicitTemplateArgumentList();
}
- CXXUnresolvedMemberExpr(ASTContext &C,
+ CXXDependentScopeMemberExpr(ASTContext &C,
Expr *Base, bool IsArrow,
SourceLocation OperatorLoc,
NestedNameSpecifier *Qualifier,
@@ -1450,7 +1450,7 @@
SourceLocation RAngleLoc);
public:
- CXXUnresolvedMemberExpr(ASTContext &C,
+ CXXDependentScopeMemberExpr(ASTContext &C,
Expr *Base, bool IsArrow,
SourceLocation OperatorLoc,
NestedNameSpecifier *Qualifier,
@@ -1458,14 +1458,14 @@
NamedDecl *FirstQualifierFoundInScope,
DeclarationName Member,
SourceLocation MemberLoc)
- : Expr(CXXUnresolvedMemberExprClass, C.DependentTy, true, true),
+ : Expr(CXXDependentScopeMemberExprClass, C.DependentTy, true, true),
Base(Base), IsArrow(IsArrow), HasExplicitTemplateArgumentList(false),
OperatorLoc(OperatorLoc),
Qualifier(Qualifier), QualifierRange(QualifierRange),
FirstQualifierFoundInScope(FirstQualifierFoundInScope),
Member(Member), MemberLoc(MemberLoc) { }
- static CXXUnresolvedMemberExpr *
+ static CXXDependentScopeMemberExpr *
Create(ASTContext &C,
Expr *Base, bool IsArrow,
SourceLocation OperatorLoc,
@@ -1579,9 +1579,9 @@
}
static bool classof(const Stmt *T) {
- return T->getStmtClass() == CXXUnresolvedMemberExprClass;
+ return T->getStmtClass() == CXXDependentScopeMemberExprClass;
}
- static bool classof(const CXXUnresolvedMemberExpr *) { return true; }
+ static bool classof(const CXXDependentScopeMemberExpr *) { return true; }
// Iterators
virtual child_iterator child_begin();
Modified: cfe/trunk/include/clang/AST/StmtNodes.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/StmtNodes.def?rev=89402&r1=89401&r2=89402&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/StmtNodes.def (original)
+++ cfe/trunk/include/clang/AST/StmtNodes.def Thu Nov 19 16:55:06 2009
@@ -127,14 +127,14 @@
EXPR(CXXPseudoDestructorExpr, Expr)
EXPR(UnresolvedFunctionNameExpr , Expr)
EXPR(UnaryTypeTraitExpr , Expr)
-EXPR(UnresolvedDeclRefExpr , Expr)
+EXPR(DependentScopeDeclRefExpr , Expr)
EXPR(TemplateIdRefExpr , Expr)
EXPR(CXXConstructExpr , Expr)
EXPR(CXXBindTemporaryExpr , Expr)
EXPR(CXXExprWithTemporaries , Expr)
EXPR(CXXTemporaryObjectExpr , CXXConstructExpr)
EXPR(CXXUnresolvedConstructExpr, Expr)
-EXPR(CXXUnresolvedMemberExpr, Expr)
+EXPR(CXXDependentScopeMemberExpr, Expr)
// Obj-C Expressions.
EXPR(ObjCStringLiteral , Expr)
Modified: cfe/trunk/lib/AST/Expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Expr.cpp?rev=89402&r1=89401&r2=89402&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Expr.cpp (original)
+++ cfe/trunk/lib/AST/Expr.cpp Thu Nov 19 16:55:06 2009
@@ -1496,14 +1496,14 @@
case Expr::CXXDeleteExprClass:
case Expr::CXXPseudoDestructorExprClass:
case Expr::UnresolvedFunctionNameExprClass:
- case Expr::UnresolvedDeclRefExprClass:
+ case Expr::DependentScopeDeclRefExprClass:
case Expr::TemplateIdRefExprClass:
case Expr::CXXConstructExprClass:
case Expr::CXXBindTemporaryExprClass:
case Expr::CXXExprWithTemporariesClass:
case Expr::CXXTemporaryObjectExprClass:
case Expr::CXXUnresolvedConstructExprClass:
- case Expr::CXXUnresolvedMemberExprClass:
+ case Expr::CXXDependentScopeMemberExprClass:
case Expr::ObjCStringLiteralClass:
case Expr::ObjCEncodeExprClass:
case Expr::ObjCMessageExprClass:
Modified: cfe/trunk/lib/AST/ExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprCXX.cpp?rev=89402&r1=89401&r2=89402&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ExprCXX.cpp (original)
+++ cfe/trunk/lib/AST/ExprCXX.cpp Thu Nov 19 16:55:06 2009
@@ -136,12 +136,12 @@
return child_iterator();
}
-// UnresolvedDeclRefExpr
-StmtIterator UnresolvedDeclRefExpr::child_begin() {
+// DependentScopeDeclRefExpr
+StmtIterator DependentScopeDeclRefExpr::child_begin() {
return child_iterator();
}
-StmtIterator UnresolvedDeclRefExpr::child_end() {
+StmtIterator DependentScopeDeclRefExpr::child_end() {
return child_iterator();
}
@@ -526,7 +526,7 @@
return child_iterator(reinterpret_cast<Stmt **>(this + 1) + NumArgs);
}
-CXXUnresolvedMemberExpr::CXXUnresolvedMemberExpr(ASTContext &C,
+CXXDependentScopeMemberExpr::CXXDependentScopeMemberExpr(ASTContext &C,
Expr *Base, bool IsArrow,
SourceLocation OperatorLoc,
NestedNameSpecifier *Qualifier,
@@ -539,7 +539,7 @@
const TemplateArgumentLoc *TemplateArgs,
unsigned NumTemplateArgs,
SourceLocation RAngleLoc)
- : Expr(CXXUnresolvedMemberExprClass, C.DependentTy, true, true),
+ : Expr(CXXDependentScopeMemberExprClass, C.DependentTy, true, true),
Base(Base), IsArrow(IsArrow),
HasExplicitTemplateArgumentList(HasExplicitTemplateArgs),
OperatorLoc(OperatorLoc),
@@ -559,8 +559,8 @@
}
}
-CXXUnresolvedMemberExpr *
-CXXUnresolvedMemberExpr::Create(ASTContext &C,
+CXXDependentScopeMemberExpr *
+CXXDependentScopeMemberExpr::Create(ASTContext &C,
Expr *Base, bool IsArrow,
SourceLocation OperatorLoc,
NestedNameSpecifier *Qualifier,
@@ -574,16 +574,16 @@
unsigned NumTemplateArgs,
SourceLocation RAngleLoc) {
if (!HasExplicitTemplateArgs)
- return new (C) CXXUnresolvedMemberExpr(C, Base, IsArrow, OperatorLoc,
+ return new (C) CXXDependentScopeMemberExpr(C, Base, IsArrow, OperatorLoc,
Qualifier, QualifierRange,
FirstQualifierFoundInScope,
Member, MemberLoc);
- void *Mem = C.Allocate(sizeof(CXXUnresolvedMemberExpr) +
+ void *Mem = C.Allocate(sizeof(CXXDependentScopeMemberExpr) +
sizeof(ExplicitTemplateArgumentList) +
sizeof(TemplateArgumentLoc) * NumTemplateArgs,
- llvm::alignof<CXXUnresolvedMemberExpr>());
- return new (Mem) CXXUnresolvedMemberExpr(C, Base, IsArrow, OperatorLoc,
+ llvm::alignof<CXXDependentScopeMemberExpr>());
+ return new (Mem) CXXDependentScopeMemberExpr(C, Base, IsArrow, OperatorLoc,
Qualifier, QualifierRange,
FirstQualifierFoundInScope,
Member,
@@ -595,10 +595,10 @@
RAngleLoc);
}
-Stmt::child_iterator CXXUnresolvedMemberExpr::child_begin() {
+Stmt::child_iterator CXXDependentScopeMemberExpr::child_begin() {
return child_iterator(&Base);
}
-Stmt::child_iterator CXXUnresolvedMemberExpr::child_end() {
+Stmt::child_iterator CXXDependentScopeMemberExpr::child_end() {
return child_iterator(&Base + 1);
}
Modified: cfe/trunk/lib/AST/StmtPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtPrinter.cpp?rev=89402&r1=89401&r2=89402&view=diff
==============================================================================
--- cfe/trunk/lib/AST/StmtPrinter.cpp (original)
+++ cfe/trunk/lib/AST/StmtPrinter.cpp Thu Nov 19 16:55:06 2009
@@ -483,7 +483,8 @@
Policy);
}
-void StmtPrinter::VisitUnresolvedDeclRefExpr(UnresolvedDeclRefExpr *Node) {
+void StmtPrinter::VisitDependentScopeDeclRefExpr(
+ DependentScopeDeclRefExpr *Node) {
Node->getQualifier()->print(OS, Policy);
OS << Node->getDeclName().getAsString();
}
@@ -1146,7 +1147,8 @@
OS << ")";
}
-void StmtPrinter::VisitCXXUnresolvedMemberExpr(CXXUnresolvedMemberExpr *Node) {
+void StmtPrinter::VisitCXXDependentScopeMemberExpr(
+ CXXDependentScopeMemberExpr *Node) {
PrintExpr(Node->getBase());
OS << (Node->isArrow() ? "->" : ".");
if (NestedNameSpecifier *Qualifier = Node->getQualifier())
Modified: cfe/trunk/lib/AST/StmtProfile.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtProfile.cpp?rev=89402&r1=89401&r2=89402&view=diff
==============================================================================
--- cfe/trunk/lib/AST/StmtProfile.cpp (original)
+++ cfe/trunk/lib/AST/StmtProfile.cpp Thu Nov 19 16:55:06 2009
@@ -526,7 +526,8 @@
VisitType(S->getQueriedType());
}
-void StmtProfiler::VisitUnresolvedDeclRefExpr(UnresolvedDeclRefExpr *S) {
+void
+StmtProfiler::VisitDependentScopeDeclRefExpr(DependentScopeDeclRefExpr *S) {
VisitExpr(S);
VisitName(S->getDeclName());
VisitNestedNameSpecifier(S->getQualifier());
@@ -554,7 +555,8 @@
VisitType(S->getTypeAsWritten());
}
-void StmtProfiler::VisitCXXUnresolvedMemberExpr(CXXUnresolvedMemberExpr *S) {
+void
+StmtProfiler::VisitCXXDependentScopeMemberExpr(CXXDependentScopeMemberExpr *S) {
VisitExpr(S);
ID.AddBoolean(S->isArrow());
VisitNestedNameSpecifier(S->getQualifier());
Modified: cfe/trunk/lib/CodeGen/Mangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/Mangle.cpp?rev=89402&r1=89401&r2=89402&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/Mangle.cpp (original)
+++ cfe/trunk/lib/CodeGen/Mangle.cpp Thu Nov 19 16:55:06 2009
@@ -1061,8 +1061,8 @@
break;
}
- case Expr::UnresolvedDeclRefExprClass: {
- const UnresolvedDeclRefExpr *DRE = cast<UnresolvedDeclRefExpr>(E);
+ case Expr::DependentScopeDeclRefExprClass: {
+ const DependentScopeDeclRefExpr *DRE = cast<DependentScopeDeclRefExpr>(E);
const Type *QTy = DRE->getQualifier()->getAsType();
assert(QTy && "Qualifier was not type!");
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=89402&r1=89401&r2=89402&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Thu Nov 19 16:55:06 2009
@@ -676,7 +676,7 @@
// names a dependent type.
// FIXME: Member of the current instantiation.
if (SS && isDependentScopeSpecifier(*SS)) {
- return Owned(new (Context) UnresolvedDeclRefExpr(Name, Context.DependentTy,
+ return Owned(new (Context) DependentScopeDeclRefExpr(Name, Context.DependentTy,
Loc, SS->getRange(),
static_cast<NestedNameSpecifier *>(SS->getScopeRep()),
isAddressOfOperand));
@@ -1868,7 +1868,7 @@
FirstQualifierInScope = FindFirstQualifierInScope(S, Qualifier);
}
- return Owned(CXXUnresolvedMemberExpr::Create(Context, BaseExpr, true,
+ return Owned(CXXDependentScopeMemberExpr::Create(Context, BaseExpr, true,
OpLoc, Qualifier,
SS? SS->getRange() : SourceRange(),
FirstQualifierInScope,
@@ -1908,7 +1908,7 @@
FirstQualifierInScope = FindFirstQualifierInScope(S, Qualifier);
}
- return Owned(CXXUnresolvedMemberExpr::Create(Context,
+ return Owned(CXXDependentScopeMemberExpr::Create(Context,
BaseExpr, false,
OpLoc,
Qualifier,
@@ -1946,7 +1946,7 @@
}
// FIXME: If DC is not computable, we should build a
- // CXXUnresolvedMemberExpr.
+ // CXXDependentScopeMemberExpr.
assert(DC && "Cannot handle non-computable dependent contexts in lookup");
}
Modified: cfe/trunk/lib/Sema/SemaTemplate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplate.cpp?rev=89402&r1=89401&r2=89402&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplate.cpp Thu Nov 19 16:55:06 2009
@@ -1679,7 +1679,7 @@
// parsed as a template template argument. However, since we now
// know that we need a non-type template argument, convert this
// template name into an expression.
- Expr *E = new (Context) UnresolvedDeclRefExpr(DTN->getIdentifier(),
+ Expr *E = new (Context) DependentScopeDeclRefExpr(DTN->getIdentifier(),
Context.DependentTy,
Arg.getTemplateNameLoc(),
Arg.getTemplateQualifierRange(),
Modified: cfe/trunk/lib/Sema/TreeTransform.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/TreeTransform.h?rev=89402&r1=89401&r2=89402&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/TreeTransform.h (original)
+++ cfe/trunk/lib/Sema/TreeTransform.h Thu Nov 19 16:55:06 2009
@@ -1456,7 +1456,7 @@
///
/// By default, performs semantic analysis to build the new expression.
/// Subclasses may override this routine to provide different behavior.
- OwningExprResult RebuildUnresolvedDeclRefExpr(NestedNameSpecifier *NNS,
+ OwningExprResult RebuildDependentScopeDeclRefExpr(NestedNameSpecifier *NNS,
SourceRange QualifierRange,
DeclarationName Name,
SourceLocation Location,
@@ -1546,7 +1546,7 @@
///
/// By default, performs semantic analysis to build the new expression.
/// Subclasses may override this routine to provide different behavior.
- OwningExprResult RebuildCXXUnresolvedMemberExpr(ExprArg BaseE,
+ OwningExprResult RebuildCXXDependentScopeMemberExpr(ExprArg BaseE,
bool IsArrow,
SourceLocation OperatorLoc,
NestedNameSpecifier *Qualifier,
@@ -1575,7 +1575,7 @@
///
/// By default, performs semantic analysis to build the new expression.
/// Subclasses may override this routine to provide different behavior.
- OwningExprResult RebuildCXXUnresolvedMemberExpr(ExprArg BaseE,
+ OwningExprResult RebuildCXXDependentScopeMemberExpr(ExprArg BaseE,
bool IsArrow,
SourceLocation OperatorLoc,
NestedNameSpecifier *Qualifier,
@@ -4592,8 +4592,8 @@
template<typename Derived>
Sema::OwningExprResult
-TreeTransform<Derived>::TransformUnresolvedDeclRefExpr(
- UnresolvedDeclRefExpr *E,
+TreeTransform<Derived>::TransformDependentScopeDeclRefExpr(
+ DependentScopeDeclRefExpr *E,
bool isAddressOfOperand) {
NestedNameSpecifier *NNS
= getDerived().TransformNestedNameSpecifier(E->getQualifier(),
@@ -4611,7 +4611,7 @@
Name == E->getDeclName())
return SemaRef.Owned(E->Retain());
- return getDerived().RebuildUnresolvedDeclRefExpr(NNS,
+ return getDerived().RebuildDependentScopeDeclRefExpr(NNS,
E->getQualifierRange(),
Name,
E->getLocation(),
@@ -4828,8 +4828,8 @@
template<typename Derived>
Sema::OwningExprResult
-TreeTransform<Derived>::TransformCXXUnresolvedMemberExpr(
- CXXUnresolvedMemberExpr *E,
+TreeTransform<Derived>::TransformCXXDependentScopeMemberExpr(
+ CXXDependentScopeMemberExpr *E,
bool isAddressOfOperand) {
// Transform the base of the expression.
OwningExprResult Base = getDerived().TransformExpr(E->getBase());
@@ -4878,7 +4878,7 @@
FirstQualifierInScope == E->getFirstQualifierFoundInScope())
return SemaRef.Owned(E->Retain());
- return getDerived().RebuildCXXUnresolvedMemberExpr(move(Base),
+ return getDerived().RebuildCXXDependentScopeMemberExpr(move(Base),
E->isArrow(),
E->getOperatorLoc(),
Qualifier,
@@ -4912,7 +4912,7 @@
return SemaRef.ExprError();
}
- return getDerived().RebuildCXXUnresolvedMemberExpr(move(Base),
+ return getDerived().RebuildCXXDependentScopeMemberExpr(move(Base),
E->isArrow(),
E->getOperatorLoc(),
Qualifier,
More information about the cfe-commits
mailing list