Move ActOnTypeAlias to SemaDecl since a type alias *is* a decl that *installs* a type. Add some fixme's and rename some junk in ASTContext relating to the typemap. Diagnose redefinitions of named types. Install a typemap entry when a data declaration is defined.

We can now declare variables to be of data type.

Swift SVN r178
This commit is contained in:
Chris Lattner
2010-10-09 22:01:25 +00:00
parent 9ba168ace5
commit ac855b690b
7 changed files with 45 additions and 24 deletions

View File

@@ -152,23 +152,21 @@ Type *ASTContext::getNamedType(Identifier Name) {
}
/// getAliasType - Return a new alias type. This returns null if there is a
/// conflict with an already existing alias type of the same name.
AliasType *ASTContext::getAliasType(Identifier Name, Type *Underlying) {
/// InstallAliasType - InstallAliasType a new alias type.
void ASTContext::InstallAliasType(Identifier Name, Type *Underlying) {
AliasType *&Entry = (*(AliasTypesMapTy*)AliasTypes)[Name];
assert(Entry == 0 && "Redefinition of alias type");
return Entry = new (*this) AliasType(Name, Underlying);
Entry = new (*this) AliasType(Name, Underlying);
}
/// getDataType - Return the type corresponding to the specified data
/// InstallDataType - Install the type corresponding to the specified data
/// declaration.
DataType *ASTContext::getDataType(DataDecl *TheDecl) {
void ASTContext::InstallDataType(DataDecl *TheDecl) {
assert(TheDecl->Name.get() != 0);
DataType *&Entry = (*(DataTypesMapTy*)DataTypes)[TheDecl->Name];
if (Entry == 0)
Entry = new (*this) DataType(TheDecl);
return Entry;
assert(Entry == 0 && "Named type redefinition");
Entry = new (*this) DataType(TheDecl);
}
/// getTupleType - Return the uniqued tuple type with the specified elements.