parent
47952aec09
commit
ff25fdf2fb
|
@ -953,6 +953,46 @@ public:
|
||||||
friend class DeclContext;
|
friend class DeclContext;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class NamespaceAliasDecl : public NamedDecl {
|
||||||
|
SourceLocation AliasLoc;
|
||||||
|
|
||||||
|
/// IdentLoc - Location of namespace identifier.
|
||||||
|
/// FIXME: We don't store location of scope specifier.
|
||||||
|
SourceLocation IdentLoc;
|
||||||
|
|
||||||
|
/// Namespace - The Decl that this alias points to. Can either be a
|
||||||
|
/// NamespaceDecl or a NamespaceAliasDecl.
|
||||||
|
NamedDecl *Namespace;
|
||||||
|
|
||||||
|
NamespaceAliasDecl(DeclContext *DC, SourceLocation L,
|
||||||
|
SourceLocation AliasLoc, IdentifierInfo *Alias,
|
||||||
|
SourceLocation IdentLoc, NamedDecl *Namespace)
|
||||||
|
: NamedDecl(Decl::NamespaceAlias, DC, L, Alias), AliasLoc(AliasLoc),
|
||||||
|
IdentLoc(IdentLoc), Namespace(Namespace) { }
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
NamespaceDecl *getNamespace() {
|
||||||
|
// FIXME: Namespace can also be an alias decl.
|
||||||
|
return cast<NamespaceDecl>(Namespace);
|
||||||
|
}
|
||||||
|
|
||||||
|
const NamespaceDecl *getNamespace() const {
|
||||||
|
return const_cast<NamespaceAliasDecl*>(this)->getNamespace();
|
||||||
|
}
|
||||||
|
|
||||||
|
static NamespaceAliasDecl *Create(ASTContext &C, DeclContext *DC,
|
||||||
|
SourceLocation L, SourceLocation AliasLoc,
|
||||||
|
IdentifierInfo *Alias,
|
||||||
|
SourceLocation IdentLoc,
|
||||||
|
NamedDecl *Namespace);
|
||||||
|
|
||||||
|
static bool classof(const Decl *D) {
|
||||||
|
return D->getKind() == Decl::NamespaceAlias;
|
||||||
|
}
|
||||||
|
static bool classof(const NamespaceAliasDecl *D) { return true; }
|
||||||
|
};
|
||||||
|
|
||||||
class StaticAssertDecl : public Decl {
|
class StaticAssertDecl : public Decl {
|
||||||
Expr *AssertExpr;
|
Expr *AssertExpr;
|
||||||
StringLiteral *Message;
|
StringLiteral *Message;
|
||||||
|
|
|
@ -78,6 +78,7 @@ ABSTRACT_DECL(Named, Decl)
|
||||||
DECL(OverloadedFunction, NamedDecl)
|
DECL(OverloadedFunction, NamedDecl)
|
||||||
DECL(Namespace, NamedDecl)
|
DECL(Namespace, NamedDecl)
|
||||||
DECL(UsingDirective, NamedDecl)
|
DECL(UsingDirective, NamedDecl)
|
||||||
|
DECL(NamespaceAlias, NamedDecl)
|
||||||
ABSTRACT_DECL(Type, NamedDecl)
|
ABSTRACT_DECL(Type, NamedDecl)
|
||||||
DECL(Typedef, TypeDecl)
|
DECL(Typedef, TypeDecl)
|
||||||
ABSTRACT_DECL(Tag, TypeDecl)
|
ABSTRACT_DECL(Tag, TypeDecl)
|
||||||
|
|
|
@ -361,6 +361,16 @@ UsingDirectiveDecl *UsingDirectiveDecl::Create(ASTContext &C, DeclContext *DC,
|
||||||
Used, CommonAncestor);
|
Used, CommonAncestor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NamespaceAliasDecl *NamespaceAliasDecl::Create(ASTContext &C, DeclContext *DC,
|
||||||
|
SourceLocation L,
|
||||||
|
SourceLocation AliasLoc,
|
||||||
|
IdentifierInfo *Alias,
|
||||||
|
SourceLocation IdentLoc,
|
||||||
|
NamedDecl *Namespace) {
|
||||||
|
return new (C) NamespaceAliasDecl(DC, L, AliasLoc, Alias, IdentLoc,
|
||||||
|
Namespace);
|
||||||
|
}
|
||||||
|
|
||||||
StaticAssertDecl *StaticAssertDecl::Create(ASTContext &C, DeclContext *DC,
|
StaticAssertDecl *StaticAssertDecl::Create(ASTContext &C, DeclContext *DC,
|
||||||
SourceLocation L, Expr *AssertExpr,
|
SourceLocation L, Expr *AssertExpr,
|
||||||
StringLiteral *Message) {
|
StringLiteral *Message) {
|
||||||
|
|
|
@ -1707,7 +1707,12 @@ Sema::DeclPtrTy Sema::ActOnNamespaceAliasDef(Scope *S,
|
||||||
return DeclPtrTy();
|
return DeclPtrTy();
|
||||||
}
|
}
|
||||||
|
|
||||||
return DeclPtrTy();
|
NamespaceAliasDecl *AliasDecl =
|
||||||
|
NamespaceAliasDecl::Create(Context, CurContext, NamespaceLoc, AliasLoc, Alias,
|
||||||
|
IdentLoc, R);
|
||||||
|
|
||||||
|
CurContext->addDecl(AliasDecl);
|
||||||
|
return DeclPtrTy::make(AliasDecl);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// AddCXXDirectInitializerToDecl - This action is called immediately after
|
/// AddCXXDirectInitializerToDecl - This action is called immediately after
|
||||||
|
|
Loading…
Reference in New Issue