#include "llvm/System/Signals.h"
#include <fstream>
#include <memory>
+#include <cstring>
using namespace llvm;
// Input/Output Options
// Optimize the module
Optimize(Composite.get());
+#if defined(_WIN32) || defined(__CYGWIN__)
+ if (!LinkAsLibrary) {
+ // Default to "a.exe" instead of "a.out".
+ if (OutputFilename.getNumOccurrences() == 0)
+ OutputFilename = "a.exe";
+
+ // If there is no suffix add an "exe" one.
+ sys::Path ExeFile( OutputFilename );
+ if (ExeFile.getSuffix() == "") {
+ ExeFile.appendSuffix("exe");
+ OutputFilename = ExeFile.toString();
+ }
+ }
+#endif
+
// Generate the bitcode for the optimized module.
std::string RealBitcodeOutput = OutputFilename;
+
if (!LinkAsLibrary) RealBitcodeOutput += ".bc";
GenerateBitcode(Composite.get(), RealBitcodeOutput);