Check in UnresolvedUsingDecl.

llvm-svn: 80336
This commit is contained in:
Anders Carlsson 2009-08-28 05:30:28 +00:00
parent 198a8c5f95
commit 8305c1fa97
4 changed files with 60 additions and 3 deletions

View File

@ -1576,20 +1576,23 @@ public:
/// UsingDecl - Represents a C++ using-declaration. For example:
/// using someNameSpace::someIdentifier;
class UsingDecl : public NamedDecl {
/// \brief The source range that covers the nested-name-specifier
/// preceding the declaration name.
SourceRange NestedNameRange;
/// \brief The source location of the target declaration name.
SourceLocation TargetNameLocation;
/// \brief The source location of the "using" location itself.
SourceLocation UsingLocation;
/// \brief Target declaration.
NamedDecl* TargetDecl;
/// \brief Target declaration.
/// \brief Target nested name specifier.
NestedNameSpecifier* TargetNestedNameDecl;
// Had 'typename' keyword.
// \brief Has 'typename' keyword.
bool IsTypeName;
UsingDecl(DeclContext *DC, SourceLocation L, SourceRange NNR,
@ -1635,6 +1638,47 @@ public:
}
static bool classof(const UsingDecl *D) { return true; }
};
/// UnresolvedUsingDecl - Represents a using declaration whose name can not
/// yet be resolved.
class UnresolvedUsingDecl : public NamedDecl {
/// \brief The source range that covers the nested-name-specifier
/// preceding the declaration name.
SourceRange TargetNestedNameRange;
/// \brief The source location of the target declaration name.
SourceLocation TargetNameLocation;
NestedNameSpecifier *TargetNestedNameSpecifier;
DeclarationName TargetName;
// \brief Has 'typename' keyword.
bool IsTypeName;
UnresolvedUsingDecl(DeclContext *DC, SourceLocation UsingLoc,
SourceRange TargetNNR, NestedNameSpecifier *TargetNNS,
SourceLocation TargetNameLoc, DeclarationName TargetName,
bool IsTypeNameArg)
: NamedDecl(Decl::UnresolvedUsing, DC, UsingLoc, TargetName),
TargetNestedNameRange(TargetNNR), TargetNameLocation(TargetNameLoc),
TargetNestedNameSpecifier(TargetNNS), TargetName(TargetName),
IsTypeName(IsTypeNameArg) { }
public:
static UnresolvedUsingDecl *Create(ASTContext &C, DeclContext *DC,
SourceLocation UsingLoc,
SourceRange TargetNNR,
NestedNameSpecifier *TargetNNS,
SourceLocation TargetNameLoc,
DeclarationName TargetName,
bool IsTypeNameArg);
static bool classof(const Decl *D) {
return D->getKind() == Decl::UnresolvedUsing;
}
static bool classof(const UnresolvedUsingDecl *D) { return true; }
};
/// StaticAssertDecl - Represents a C++0x static_assert declaration.
class StaticAssertDecl : public Decl {

View File

@ -111,6 +111,7 @@ ABSTRACT_DECL(Named, Decl)
DECL(ClassTemplate, TemplateDecl)
DECL(TemplateTemplateParm, TemplateDecl)
DECL(Using, NamedDecl)
DECL(UnresolvedUsing, NamedDecl)
DECL(ObjCMethod, NamedDecl)
DECL(ObjCContainer, NamedDecl)
DECL(ObjCCategory, ObjCContainerDecl)

View File

@ -191,6 +191,7 @@ unsigned Decl::getIdentifierNamespaceForKind(Kind DeclKind) {
case OriginalParmVar:
case NonTypeTemplateParm:
case Using:
case UnresolvedUsing:
case ObjCMethod:
case ObjCContainer:
case ObjCCategory:

View File

@ -832,6 +832,17 @@ UsingDecl *UsingDecl::Create(ASTContext &C, DeclContext *DC,
TargetNNS, IsTypeNameArg);
}
UnresolvedUsingDecl *UnresolvedUsingDecl::Create(ASTContext &C, DeclContext *DC,
SourceLocation UsingLoc,
SourceRange TargetNNR,
NestedNameSpecifier *TargetNNS,
SourceLocation TargetNameLoc,
DeclarationName TargetName,
bool IsTypeNameArg) {
return new (C) UnresolvedUsingDecl(DC, UsingLoc, TargetNNR, TargetNNS,
TargetNameLoc, TargetName, IsTypeNameArg);
}
StaticAssertDecl *StaticAssertDecl::Create(ASTContext &C, DeclContext *DC,
SourceLocation L, Expr *AssertExpr,
StringLiteral *Message) {