Make SourceFile a DeclContext, but don't actually do anything with it yet.

Swift SVN r9646
This commit is contained in:
Jordan Rose
2013-10-24 18:59:21 +00:00
parent ec23db6962
commit 0702acab3d
13 changed files with 75 additions and 13 deletions

View File

@@ -340,7 +340,7 @@ public:
/// the REPL). Since it contains raw source, it must be parsed and name-bound
/// before being used for anything; a full type-check is also necessary for
/// IR generation.
class SourceFile {
class SourceFile : public DeclContext {
friend class Module;
public:
@@ -362,6 +362,7 @@ private:
public:
/// The translation unit that this file is a part of.
// FIXME: Redundant with the decl context parent, but definitely convenient.
TranslationUnit &TU;
/// The list of top-level declarations in the source file.
@@ -462,6 +463,10 @@ public:
/// \param options Options controlling the printing process.
void print(raw_ostream &os, const PrintOptions &options);
static bool classof(const DeclContext *DC) {
return DC->getContextKind() == DeclContextKind::SourceFile;
}
private:
// Make placement new and vanilla new/delete illegal for SourceFiles.
void *operator new(size_t Bytes) throw() = delete;