From d1ff4e9fd30a7ac2a4216f261412e16ce58cf525 Mon Sep 17 00:00:00 2001 From: Alexey Prokhin Date: Tue, 4 Jan 2011 20:59:39 +0300 Subject: [PATCH] Fix compilation of ldc1 --- dmd/mars.h | 2 +- dmd/module.c | 10 ++++++++++ dmd/module.h | 5 +++++ dmd/statement.h | 5 +++-- 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/dmd/mars.h b/dmd/mars.h index 3a6a46fa..d8647322 100644 --- a/dmd/mars.h +++ b/dmd/mars.h @@ -203,7 +203,7 @@ struct Param char *hdrdir; // write 'header' file to docdir directory char *hdrname; // write 'header' file to docname - char doXGeneration; // write JSON file + bool doXGeneration; // write JSON file char *xfilename; // write JSON file to xfilename unsigned debuglevel; // debug level diff --git a/dmd/module.c b/dmd/module.c index d82d24c4..ffc012fe 100644 --- a/dmd/module.c +++ b/dmd/module.c @@ -45,6 +45,9 @@ #endif #if IN_LLVM +#include "llvm/Type.h" +#include "llvm/LLVMContext.h" +#include "llvm/DerivedTypes.h" #include "llvm/Support/CommandLine.h" #include @@ -146,10 +149,14 @@ Module::Module(char *filename, Identifier *ident, int doDocComment, int doHdrGen } srcfile = new File(srcfilename); +#if IN_LLVM // LDC llvmForceLogging = false; + moduleInfoVar = NULL; + moduleInfoType = new llvm::PATypeHolder(llvm::OpaqueType::get(llvm::getGlobalContext())); this->doDocComment = doDocComment; this->doHdrGen = doHdrGen; +#endif } File* Module::buildFilePath(const char* forcename, const char* path, const char* ext) @@ -282,6 +289,9 @@ void Module::deleteObjFile() Module::~Module() { +#if IN_LLVM + delete moduleInfoType; +#endif } const char *Module::kind() diff --git a/dmd/module.h b/dmd/module.h index 8b674c3b..2ff9c9d4 100644 --- a/dmd/module.h +++ b/dmd/module.h @@ -34,6 +34,8 @@ typedef DValue elem; namespace llvm { class LLVMContext; class Module; + class GlobalVariable; + class PATypeHolder; } #else @@ -194,8 +196,11 @@ struct Module : Package void buildTargetFiles(bool singleObj); File* buildFilePath(const char* forcename, const char* path, const char* ext); Module *isModule() { return this; } + llvm::GlobalVariable* moduleInfoSymbol(); bool llvmForceLogging; + llvm::GlobalVariable* moduleInfoVar; + llvm::PATypeHolder* moduleInfoType; // array ops emitted in this module already StringTable arrayfuncs; diff --git a/dmd/statement.h b/dmd/statement.h index 890bddb4..150fa71d 100644 --- a/dmd/statement.h +++ b/dmd/statement.h @@ -541,9 +541,10 @@ struct CaseStatement : Statement CaseStatement* isCaseStatement() { return this; } - // LDC +#if IN_LLVM llvm::BasicBlock* bodyBB; - llvm::ConstantInt* llvmIdx; + llvm::Value* llvmIdx; +#endif }; #if DMDV2