1 //===--- llvmcc.cpp - The LLVM Compiler Driver ------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open
6 // Source License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
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.
15 //===----------------------------------------------------------------------===//
21 #include "llvm/System/Path.h"
22 #include "llvm/Support/CommandLine.h"
29 using namespace llvmcc;
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"));
41 int BuildTargets(const CompilationGraph& graph) {
43 sys::Path tempDir(sys::Path::GetTemporaryDirectory());
46 ret = graph.Build(tempDir);
49 tempDir.eraseFromDisk(true);
53 tempDir.eraseFromDisk(true);
58 int main(int argc, char** argv) {
60 CompilationGraph graph;
62 cl::ParseCommandLineOptions(argc, argv,
63 "LLVM Compiler Driver(Work In Progress)");
64 PopulateCompilationGraph(graph);
65 return BuildTargets(graph);
67 catch(const std::exception& ex) {
68 std::cerr << ex.what() << '\n';
71 std::cerr << "Unknown error!\n";