Support building swift/AST with MSVC on Windows

This commit is contained in:
Hugh Bellamy
2016-11-28 16:55:15 +00:00
parent 5b4223076a
commit 7a5ef4bdd1
32 changed files with 191 additions and 9 deletions

View File

@@ -506,7 +506,11 @@ public:
private:
// Make placement new and vanilla new/delete illegal for Modules.
void *operator new(size_t Bytes) throw() = delete;
// Work around MSVC error: attempting to reference a deleted function.
#if !defined(_MSC_VER) && !defined(__clang__)
void operator delete(void *Data) throw() = delete;
#endif
void *operator new(size_t Bytes, void *Mem) throw() = delete;
public:
// Only allow allocation of Modules using the allocator in ASTContext
@@ -515,6 +519,8 @@ public:
unsigned Alignment = alignof(ModuleDecl));
};
static inline unsigned alignOfFileUnit();
/// A container for module-scope declarations that itself provides a scope; the
/// smallest unit of code organization.
///
@@ -741,8 +747,12 @@ public:
// Only allow allocation of FileUnits using the allocator in ASTContext
// or by doing a placement new.
void *operator new(size_t Bytes, ASTContext &C,
unsigned Alignment = alignof(FileUnit));
unsigned Alignment = alignOfFileUnit());
};
static inline unsigned alignOfFileUnit() {
return alignof(FileUnit&);
}
/// A file containing Swift source code.
///