Remove LDC-specific global.obj_ext_alt

No functional changes intended.
This commit is contained in:
Martin 2016-08-28 20:10:01 +02:00
parent 60a3accffd
commit 41fb7830df
7 changed files with 24 additions and 38 deletions

View file

@ -240,7 +240,6 @@ struct Global
const(char)* obj_ext;
version(IN_LLVM)
{
const(char)* obj_ext_alt;
const(char)* ll_ext;
const(char)* bc_ext;
const(char)* s_ext;
@ -324,7 +323,6 @@ version(IN_LLVM)
bc_ext = "bc";
s_ext = "s";
obj_ext = "o";
obj_ext_alt = "obj";
}
else
{

View file

@ -236,7 +236,6 @@ struct Global
const char *mars_ext;
const char *obj_ext;
#if IN_LLVM
const char *obj_ext_alt;
const char *ll_ext;
const char *bc_ext;
const char *s_ext;

View file

@ -1248,26 +1248,20 @@ extern (C++) int mars_mainBody(ref Strings files, ref Strings libmodules,
{
/* Deduce what to do with a file based on its extension
*/
version (IN_LLVM)
{
if (FileName.equals(ext, global.obj_ext) ||
(TARGET_WINDOS && FileName.equals(ext, global.obj_ext_alt)))
{
global.params.objfiles.push(files[i]);
continue;
}
// Detect LLVM bitcode files on commandline
if (FileName.equals(ext, global.bc_ext)) {
global.params.bitcodeFiles.push(files[i]);
continue;
}
}
else
{
if (FileName.equals(ext, global.obj_ext))
{
global.params.objfiles.push(files[i]);
version (IN_LLVM) {} else
{
libmodules.push(files[i]);
}
continue;
}
version (IN_LLVM)
{
// Detect LLVM bitcode files on commandline
if (FileName.equals(ext, global.bc_ext)) {
global.params.bitcodeFiles.push(files[i]);
continue;
}
}

View file

@ -91,9 +91,7 @@ CodeGenerator::~CodeGenerator() {
const char *oname;
const char *filename;
if ((oname = global.params.exefile) || (oname = global.params.objname)) {
filename = FileName::forceExt(
oname, global.params.targetTriple->isOSWindows() ? global.obj_ext_alt
: global.obj_ext);
filename = FileName::forceExt(oname, global.obj_ext);
if (global.params.objdir) {
filename =
FileName::combine(global.params.objdir, FileName::name(filename));

View file

@ -71,16 +71,11 @@ public:
}
};
const char *cacheObjectExtension() {
return global.params.targetTriple->isOSWindows() ? global.obj_ext_alt
: global.obj_ext;
}
void storeCacheFileName(llvm::StringRef cacheObjectHash,
llvm::SmallString<128> &filePath) {
filePath = opts::ir2objCacheDir;
llvm::sys::path::append(filePath, llvm::Twine("ircache_") + cacheObjectHash +
"." + cacheObjectExtension());
"." + global.obj_ext);
}
}

View file

@ -608,8 +608,10 @@ static void parseCommandLine(int argc, char **argv, Strings &sourceFiles,
} else if (strcmp(ext, global.s_ext) == 0) {
global.params.output_s = OUTPUTFLAGset;
autofound = true;
} else if (strcmp(ext, global.obj_ext) == 0 ||
strcmp(ext, global.obj_ext_alt) == 0) {
} else if (strcmp(ext, global.obj_ext) == 0 || strcmp(ext, "obj") == 0) {
// global.obj_ext hasn't been corrected yet for MSVC targets as we first
// need the command line to figure out the target...
// so treat both 'o' and 'obj' extensions as object files
global.params.output_o = OUTPUTFLAGset;
autofound = true;
} else {
@ -1089,6 +1091,8 @@ int cppmain(int argc, char **argv) {
// mscoff enables slightly different handling of interface functions
// in the front end
global.params.mscoff = triple->isKnownWindowsMSVCEnvironment();
if (global.params.mscoff)
global.obj_ext = "obj";
}
// allocate the target abi
@ -1108,7 +1112,8 @@ int cppmain(int argc, char **argv) {
}
Strings libmodules;
return mars_mainBody(files, libmodules, createStaticLib, createSharedLib, staticFlag);
return mars_mainBody(files, libmodules, createStaticLib, createSharedLib,
staticFlag);
}
void codegenModules(Modules &modules) {

View file

@ -86,9 +86,6 @@ void buildTargetFiles(Module *m, bool singleObj, bool library) {
if (!m->objfile) {
const char *objname = library ? nullptr : global.params.objname;
if (global.params.output_o) {
const char *extension = global.params.targetTriple->isOSWindows()
? global.obj_ext_alt
: global.obj_ext;
llvm::SmallString<128> tempFilename; // must outlive buildFilePath call
if (global.params.run) {
using namespace llvm;
@ -99,21 +96,21 @@ void buildTargetFiles(Module *m, bool singleObj, bool library) {
std::error_code EC;
if (global.params.objdir) {
// Prepend with path to form absolute filename.
EC = sys::fs::createUniqueFile(Twine(global.params.objdir) +
sys::path::get_separator() +
tmpname + "-%%%%%%%." + extension,
EC = sys::fs::createUniqueFile(
Twine(global.params.objdir) + sys::path::get_separator() +
tmpname + "-%%%%%%%." + global.obj_ext,
tempFilename);
} else {
// Uses current dir as base for file.
EC = sys::fs::createUniqueFile(
Twine(tmpname) + "-%%%%%%%." + extension, tempFilename);
Twine(tmpname) + "-%%%%%%%." + global.obj_ext, tempFilename);
}
if (!EC) {
objname = tempFilename.c_str();
}
}
m->objfile = m->buildFilePath(objname, global.params.objdir, extension,
library, fqnNames);
m->objfile = m->buildFilePath(objname, global.params.objdir,
global.obj_ext, library, fqnNames);
} else if (global.params.output_bc) {
m->objfile = m->buildFilePath(objname, global.params.objdir,
global.bc_ext, library, fqnNames);