@@ -90,15 +90,18 @@ static cl::list<std::string, StringsAdapter> importPaths("I",
9090 cl::Prefix);
9191
9292static cl::opt<std::string> defaultLib (" defaultlib" ,
93- cl::desc (" Default libraries for non-debug-info build (overrides previous)" ),
93+ cl::desc (" Default libraries to link with (overrides previous)" ),
9494 cl::value_desc(" lib1,lib2,..." ),
9595 cl::ZeroOrMore);
9696
9797static cl::opt<std::string> debugLib (" debuglib" ,
98- cl::desc (" Default libraries for debug info build (overrides previous)" ),
98+ cl::desc (" Debug versions of default libraries (overrides previous)" ),
9999 cl::value_desc(" lib1,lib2,..." ),
100100 cl::ZeroOrMore);
101101
102+ static cl::opt<bool > linkDebugLib (" link-debuglib" ,
103+ cl::desc (" Link with libraries specified in -debuglib, not -defaultlib" ),
104+ cl::ZeroOrMore);
102105
103106#if LDC_LLVM_VER < 304
104107namespace llvm {
@@ -401,8 +404,16 @@ static void parseCommandLine(int argc, char **argv, Strings &sourceFiles, bool &
401404 sourceFiles.reserve (fileList.size ());
402405 typedef std::vector<std::string>::iterator It;
403406 for (It I = fileList.begin (), E = fileList.end (); I != E; ++I)
407+ {
404408 if (!I->empty ())
405- sourceFiles.push (mem.xstrdup (I->c_str ()));
409+ {
410+ char * copy = mem.xstrdup (I->c_str ());
411+ #ifdef _WIN32
412+ std::replace (copy, copy + I->length (), ' /' , ' \\ ' );
413+ #endif
414+ sourceFiles.push (copy);
415+ }
416+ }
406417
407418 if (noDefaultLib)
408419 {
@@ -413,8 +424,7 @@ static void parseCommandLine(int argc, char **argv, Strings &sourceFiles, bool &
413424 else
414425 {
415426 // Parse comma-separated default library list.
416- std::stringstream libNames (
417- global.params .symdebug ? debugLib : defaultLib);
427+ std::stringstream libNames (linkDebugLib ? debugLib : defaultLib);
418428 while (libNames.good ())
419429 {
420430 std::string lib;
@@ -1077,7 +1087,7 @@ int main(int argc, char **argv)
10771087 const char *ext;
10781088 const char *name;
10791089
1080- const char *p = static_cast < const char *>( files.data [i]) ;
1090+ const char *p = files.data [i];
10811091
10821092 p = FileName::name (p); // strip path
10831093 ext = FileName::ext (p);
@@ -1176,7 +1186,7 @@ int main(int argc, char **argv)
11761186 }
11771187
11781188 id = Identifier::idPool (name);
1179- Module *m = new Module (static_cast < const char *>( files.data [i]) , id, global.params .doDocComments , global.params .doHdrGeneration );
1189+ Module *m = new Module (files.data [i], id, global.params .doDocComments , global.params .doHdrGeneration );
11801190 modules.push (m);
11811191 }
11821192
0 commit comments