tidy up. remove unused local.
[oota-llvm.git] / lib / CompilerDriver / Main.cpp
index 28b2737f38b893647bd0d808ac47abff12462ba9..0a6613aa77a3b4e4d1f172e88b4c4a9da01cad37 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
+#include "llvm/CompilerDriver/AutoGenerated.h"
 #include "llvm/CompilerDriver/BuiltinOptions.h"
 #include "llvm/CompilerDriver/CompilationGraph.h"
 #include "llvm/CompilerDriver/Error.h"
-#include "llvm/CompilerDriver/Plugin.h"
 
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/System/Path.h"
@@ -30,7 +30,9 @@ namespace {
 
   std::stringstream* GlobalTimeLog;
 
-  int getTempDir(sys::Path& tempDir) {
+  /// GetTempDir - Get the temporary directory location. Returns non-zero value
+  /// on error.
+  int GetTempDir(sys::Path& tempDir) {
     // The --temp-dir option.
     if (!TempDirname.empty()) {
       tempDir = TempDirname;
@@ -53,20 +55,21 @@ namespace {
       std::string ErrMsg;
       if (tempDir.createDirectoryOnDisk(true, &ErrMsg)) {
         PrintError(ErrMsg);
-        return -1;
+        return 1;
       }
     }
 
     return 0;
   }
 
-  /// BuildTargets - A small wrapper for CompilationGraph::Build.
+  /// BuildTargets - A small wrapper for CompilationGraph::Build. Returns
+  /// non-zero value in case of error.
   int BuildTargets(CompilationGraph& graph, const LanguageMap& langMap) {
     int ret;
     sys::Path tempDir;
     bool toDelete = (SaveTemps == SaveTempsEnum::Unset);
 
-    if (int ret = getTempDir(tempDir))
+    if (int ret = GetTempDir(tempDir))
       return ret;
 
     ret = graph.Build(tempDir, langMap);
@@ -85,7 +88,7 @@ void AppendToGlobalTimeLog(const std::string& cmd, double time) {
   *GlobalTimeLog << "# " << cmd << ' ' << time << '\n';
 }
 
-// Sometimes plugins want to condition on the value in argv[0].
+// Sometimes user code wants to access the argv[0] value.
 const char* ProgramName;
 
 int Main(int argc, char** argv) {
@@ -96,11 +99,11 @@ int Main(int argc, char** argv) {
   ProgramName = argv[0];
 
   cl::ParseCommandLineOptions
-    (argc, argv, "LLVM Compiler Driver (Work In Progress)",
+    (argc, argv,
+     /* Overview = */ "LLVM Compiler Driver (Work In Progress)",
      /* ReadResponseFiles = */ false);
 
-  PluginLoader Plugins;
-  if (int ret = Plugins.RunInitialization(langMap, graph))
+  if (int ret = autogenerated::RunInitialization(langMap, graph))
     return ret;
 
   if (CheckGraph) {