blob: ad6c807327214c4105963bd32c4f1084c759bc45 [file] [log] [blame]
Daniel Dunbar3ede8d02009-03-02 19:59:07 +00001//===-- driver.cpp - Clang GCC-Compatible Driver --------------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
Daniel Dunbar1eb4e642009-03-03 05:55:11 +000010// This is the entry point to the clang driver; it is a thin wrapper
11// for functionality in the Driver clang library.
Daniel Dunbar3ede8d02009-03-02 19:59:07 +000012//
13//===----------------------------------------------------------------------===//
14
15#include "clang/Driver/Compilation.h"
16#include "clang/Driver/Driver.h"
Daniel Dunbar2c6f6f32009-03-04 08:33:23 +000017#include "clang/Driver/Option.h"
18#include "clang/Driver/Options.h"
19
Daniel Dunbar3ede8d02009-03-02 19:59:07 +000020#include "llvm/ADT/OwningPtr.h"
Daniel Dunbar365c02f2009-03-10 20:52:46 +000021#include "llvm/System/Path.h"
Daniel Dunbar3ede8d02009-03-02 19:59:07 +000022#include "llvm/System/Signals.h"
Daniel Dunbar1b3bb6e2009-03-04 20:49:20 +000023using namespace clang::driver;
Daniel Dunbar3ede8d02009-03-02 19:59:07 +000024
25int main(int argc, const char **argv) {
26 llvm::sys::PrintStackTraceOnErrorSignal();
27
Daniel Dunbar365c02f2009-03-10 20:52:46 +000028 // FIXME: We should use GetMainExecutable here, probably, but we may
29 // want to handle symbolic links slightly differently. The problem
30 // is that the path derived from this will influence search paths.
31 llvm::sys::Path Path(argv[0]);
32
33 llvm::OwningPtr<Driver> TheDriver(new Driver(Path.getBasename().c_str(),
34 Path.getDirname().c_str()));
Daniel Dunbar3ede8d02009-03-02 19:59:07 +000035
36 llvm::OwningPtr<Compilation> C(TheDriver->BuildCompilation(argc, argv));
37
38 return C->Execute();
39}