Replace global.params.singleObj by global.params.oneobj

singleObj was LDC-specific.
This commit is contained in:
Martin 2016-08-31 20:12:57 +02:00
parent 94d607acb2
commit c748eb9ed0
6 changed files with 5 additions and 18 deletions

View file

@ -216,7 +216,6 @@ struct Param
const(void)* targetTriple; // const llvm::Triple* const(void)* targetTriple; // const llvm::Triple*
// Codegen cl options // Codegen cl options
bool singleObj;
bool disableRedZone; bool disableRedZone;
uint hashThreshold; // MD5 hash symbols larger than this threshold (0 = no hashing) uint hashThreshold; // MD5 hash symbols larger than this threshold (0 = no hashing)

View file

@ -214,7 +214,6 @@ struct Param
const llvm::Triple *targetTriple; const llvm::Triple *targetTriple;
// Codegen cl options // Codegen cl options
bool singleObj;
bool disableRedZone; bool disableRedZone;
uint32_t hashThreshold; // MD5 hash symbols larger than this threshold (0 = no hashing) uint32_t hashThreshold; // MD5 hash symbols larger than this threshold (0 = no hashing)

View file

@ -1404,13 +1404,6 @@ extern (C++) int mars_mainBody(ref Strings files, ref Strings libmodules)
if (!Module.rootModule) if (!Module.rootModule)
Module.rootModule = m; Module.rootModule = m;
m.importedFrom = m; // m->isRoot() == true m.importedFrom = m; // m->isRoot() == true
version (IN_LLVM)
{
m.parse();
m.deleteObjFile();
}
else
{
if (!global.params.oneobj || modi == 0 || m.isDocFile) if (!global.params.oneobj || modi == 0 || m.isDocFile)
m.deleteObjFile(); m.deleteObjFile();
static if (ASYNCREAD) static if (ASYNCREAD)
@ -1422,7 +1415,6 @@ extern (C++) int mars_mainBody(ref Strings files, ref Strings libmodules)
} }
} }
m.parse(); m.parse();
}
if (m.isDocFile) if (m.isDocFile)
{ {
anydocfiles = true; anydocfiles = true;
@ -1640,7 +1632,7 @@ extern (C++) int mars_mainBody(ref Strings files, ref Strings libmodules)
if (global.params.run) if (global.params.run)
m.makeObjectFilenameUnique(); m.makeObjectFilenameUnique();
if (!global.params.singleObj) if (!global.params.oneobj || i == 0)
m.checkAndAddOutputFile(m.objfile); m.checkAndAddOutputFile(m.objfile);
} }
@ -1732,11 +1724,8 @@ extern (C++) int mars_mainBody(ref Strings files, ref Strings libmodules)
for (size_t i = 0; i < modules.dim; i++) for (size_t i = 0; i < modules.dim; i++)
{ {
modules[i].deleteObjFile(); modules[i].deleteObjFile();
version (IN_LLVM) {} else
{
if (global.params.oneobj) if (global.params.oneobj)
break; break;
}
} }
deleteExeFile(); deleteExeFile();
} }

View file

@ -382,7 +382,7 @@ static cl::opt<MultiSetter, true, cl::parser<bool>>
cl::opt<bool, true> cl::opt<bool, true>
singleObj("singleobj", cl::desc("Create only a single output object file"), singleObj("singleobj", cl::desc("Create only a single output object file"),
cl::location(global.params.singleObj)); cl::location(global.params.oneobj));
cl::opt<uint32_t, true> hashThreshold( cl::opt<uint32_t, true> hashThreshold(
"hash-threshold", "hash-threshold",

View file

@ -133,7 +133,7 @@ void CodeGenerator::prepareLLModule(Module *m) {
#endif #endif
// TODO: Make ldc::DIBuilder per-Module to be able to emit several CUs for // TODO: Make ldc::DIBuilder per-Module to be able to emit several CUs for
// singleObj compilations? // single-object compilations?
ir_->DBuilder.EmitCompileUnit(m); ir_->DBuilder.EmitCompileUnit(m);
IrDsymbol::resetAll(); IrDsymbol::resetAll();

View file

@ -653,7 +653,7 @@ static void parseCommandLine(int argc, char **argv, Strings &sourceFiles,
} else if (global.params.run) { } else if (global.params.run) {
error(Loc(), "flags conflict with -run"); error(Loc(), "flags conflict with -run");
} else if (global.params.objname && sourceFiles.dim > 1) { } else if (global.params.objname && sourceFiles.dim > 1) {
if (!(global.params.lib || global.params.dll) && !singleObj) { if (!(global.params.lib || global.params.dll) && !global.params.oneobj) {
error(Loc(), "multiple source files, but only one .obj name"); error(Loc(), "multiple source files, but only one .obj name");
} }
} }
@ -1117,7 +1117,7 @@ int cppmain(int argc, char **argv) {
void codegenModules(Modules &modules) { void codegenModules(Modules &modules) {
// Generate one or more object/IR/bitcode files. // Generate one or more object/IR/bitcode files.
if (global.params.obj && !modules.empty()) { if (global.params.obj && !modules.empty()) {
ldc::CodeGenerator cg(getGlobalContext(), singleObj); ldc::CodeGenerator cg(getGlobalContext(), global.params.oneobj);
// When inlining is enabled, we are calling semantic3 on function // When inlining is enabled, we are calling semantic3 on function
// declarations, which may _add_ members to the first module in the modules // declarations, which may _add_ members to the first module in the modules