Remove an unused command line option.
[oota-llvm.git] / tools / llvmc2 / llvmcc.cpp
1 //===--- llvmcc.cpp - The LLVM Compiler Driver ------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open
6 // Source License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 //  This tool provides a single point of access to the LLVM
11 //  compilation tools.  It has many options. To discover the options
12 //  supported please refer to the tools' manual page or run the tool
13 //  with the --help option.
14 //
15 //===----------------------------------------------------------------------===//
16
17 #include "Core.h"
18 #include "Utility.h"
19 #include "Tools.h"
20
21 #include "llvm/System/Path.h"
22 #include "llvm/Support/CommandLine.h"
23
24 #include <iostream>
25 #include <stdexcept>
26 #include <string>
27
28 using namespace llvm;
29 using namespace llvmcc;
30
31 // These variables are also used in Core.cpp,
32 // so they should have external linkage.
33 cl::list<std::string> InputFilenames(cl::Positional,
34                                      cl::desc("<input file>"), cl::OneOrMore);
35 cl::opt<std::string> OutputFilename("o", cl::desc("Output file name"),
36                                     cl::value_desc("file"));
37 cl::opt<bool> VerboseMode("v", cl::desc("Enable verbose mode"));
38
39
40 namespace {
41   int BuildTargets(const CompilationGraph& graph) {
42     int ret;
43     sys::Path tempDir(sys::Path::GetTemporaryDirectory());
44
45     try {
46       ret = graph.Build(tempDir);
47     }
48     catch(...) {
49       tempDir.eraseFromDisk(true);
50       throw;
51     }
52
53     tempDir.eraseFromDisk(true);
54     return ret;
55   }
56 }
57
58 int main(int argc, char** argv) {
59   try {
60     CompilationGraph graph;
61
62     cl::ParseCommandLineOptions(argc, argv,
63                                 "LLVM Compiler Driver(Work In Progress)");
64     PopulateCompilationGraph(graph);
65     return BuildTargets(graph);
66   }
67   catch(const std::exception& ex) {
68     std::cerr << ex.what() << '\n';
69   }
70   catch(...) {
71     std::cerr << "Unknown error!\n";
72   }
73 }