changeset 1645:1d2d1aa16841

Don't error out with -singleobj, -of, and -c/-output-{bc,ll,o,s}.
author Matti Niemenmaa <matti.niemenmaa+hg@iki.fi>
date Tue, 09 Mar 2010 23:20:39 +0200
parents 9176437d98be
children a8fc855f156e
files dmd/module.c dmd/module.h gen/main.cpp
diffstat 3 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/dmd/module.c	Tue Mar 09 23:07:08 2010 +0200
+++ b/dmd/module.c	Tue Mar 09 23:20:39 2010 +0200
@@ -219,7 +219,7 @@
     files.insert(std::make_pair(str, NewMod));
 }
 
-void Module::buildTargetFiles()
+void Module::buildTargetFiles(bool singleObj)
 {
     if(objfile && 
        (!doDocComment || docfile) && 
@@ -252,7 +252,8 @@
 
     // LDC
     // another safety check to make sure we don't overwrite previous output files
-    check_and_add_output_file(this, objfile->name->str);
+    if (!singleObj)
+        check_and_add_output_file(this, objfile->name->str);
     if (docfile)
         check_and_add_output_file(this, docfile->name->str);
     if (hdrfile)
--- a/dmd/module.h	Tue Mar 09 23:07:08 2010 +0200
+++ b/dmd/module.h	Tue Mar 09 23:20:39 2010 +0200
@@ -188,7 +188,7 @@
 #if IN_LLVM
     // LDC
     llvm::Module* genLLVMModule(llvm::LLVMContext& context, Ir* sir);
-    void buildTargetFiles();
+    void buildTargetFiles(bool singleObj);
     File* buildFilePath(const char* forcename, const char* path, const char* ext);
     Module *isModule() { return this; }
 
--- a/gen/main.cpp	Tue Mar 09 23:07:08 2010 +0200
+++ b/gen/main.cpp	Tue Mar 09 23:20:39 2010 +0200
@@ -781,7 +781,7 @@
         m->importedFrom = m;
         m->read(0);
         m->parse();
-        m->buildTargetFiles();
+        m->buildTargetFiles(singleObj);
         m->deleteObjFile();
         if (m->isDocFile)
         {