Remove the type symbol table from ASTContext, using the scoped hash table in SemaDecl instead. We resolve a bunch of fixmes (types now give a "previous definition here" diag), remove weird mutating state from ASTContext, and allow us to have shadowed types.

Swift SVN r234
This commit is contained in:
Chris Lattner
2011-02-22 07:02:00 +00:00
parent 5a74864a71
commit f9673bb44a
6 changed files with 43 additions and 73 deletions

View File

@@ -43,7 +43,6 @@ class ASTContext {
llvm::BumpPtrAllocator *Allocator;
void *IdentifierTable; // llvm::StringMap<char>
void *TypeDecls; // llvm::DenseMap<Identifier, NamedTypeDecl*>
void *TupleTypes; // llvm::FoldingSet<TupleType>
void *FunctionTypes; // DenseMap<std::pair<Type*, Type*>, FunctionType*>
void *ArrayTypes; // DenseMap<std::pair<Type*, uint64_t>, ArrayType*>
@@ -74,17 +73,6 @@ public:
Type * const TheDependentType; /// TheDependentType - Dependent on context.
Type * const TheInt32Type; /// TheInt32Type - 32-bit signed integer.
/// getNamedType - This method does a lookup for the specified type name. If
/// no type with the specified name exists, null is returned.
///
/// FIXME: This is a total hack since we don't have scopes for types.
/// getNamedType should eventually be replaced. At that point, the "install"
/// functions should move out of here.
NamedTypeDecl *getNamedType(Identifier Name);
/// installTypeDecl - Add a new named type decl to the named type map.
void installTypeDecl(Identifier Name, NamedTypeDecl *Decl);
/// getTupleType - Return the uniqued tuple type with the specified elements.
TupleType *getTupleType(const TupleTypeElt *Fields,
unsigned NumFields);

View File

@@ -28,6 +28,7 @@
namespace swift {
class Expr;
class Type;
class NamedTypeDecl;
class TypeAliasDecl;
class OneOfDecl;
class VarDecl;
@@ -56,11 +57,16 @@ public:
/// AddToScope - Register the specified decl as being in the current lexical
/// scope.
void AddToScope(ValueDecl *D);
void AddToScope(NamedTypeDecl *D);
/// LookupValueName - Perform a lexical scope lookup for the specified name in
/// a value context, returning the active decl if found or null if not.
ValueDecl *LookupValueName(Identifier Name);
/// LookupTypeName - Perform a lexical scope lookup for the specified name in
/// a type context, returning the active decl if found or null if not.
NamedTypeDecl *LookupTypeName(Identifier Name);
/// AnonClosureArgs - These are the current active set of anonymous closure
/// arguments, named $0 ... $9. These are added to the list when first