]> granicus.if.org Git - clang/commitdiff
Stub out some structure for C++ driver.
authorDaniel Dunbar <daniel@zuster.org>
Mon, 2 Mar 2009 19:59:07 +0000 (19:59 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Mon, 2 Mar 2009 19:59:07 +0000 (19:59 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65867 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Driver/Compilation.h [new file with mode: 0644]
include/clang/Driver/Driver.h [new file with mode: 0644]
lib/Driver/Compilation.cpp [new file with mode: 0644]
lib/Driver/Driver.cpp [new file with mode: 0644]
lib/Driver/Makefile [new file with mode: 0644]
lib/Makefile
tools/Makefile
tools/driver/Makefile [new file with mode: 0644]
tools/driver/driver.cpp [new file with mode: 0644]

diff --git a/include/clang/Driver/Compilation.h b/include/clang/Driver/Compilation.h
new file mode 100644 (file)
index 0000000..d4792e8
--- /dev/null
@@ -0,0 +1,29 @@
+//===--- Compilation.h - Compilation Task Data Structure --------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef CLANG_DRIVER_COMPILATION_H_
+#define CLANG_DRIVER_COMPILATION_H_
+
+namespace clang {
+
+/// Compilation - A set of tasks to perform for a single driver
+/// invocation.
+class Compilation {
+public:
+  Compilation();
+  ~Compilation();
+
+  /// Execute - Execute the compilation jobs and return an
+  /// appropriate exit code.
+  int Execute() const;
+};
+
+} // end namespace clang
+
+#endif
diff --git a/include/clang/Driver/Driver.h b/include/clang/Driver/Driver.h
new file mode 100644 (file)
index 0000000..62bcd43
--- /dev/null
@@ -0,0 +1,30 @@
+//===--- Driver.h - Clang GCC Compatible Driver -----------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef CLANG_DRIVER_DRIVER_H_
+#define CLANG_DRIVER_DRIVER_H_
+
+namespace clang {
+  class Compilation;
+
+/// Driver - Encapsulate logic for constructing compilation processes
+/// from a set of gcc-driver-like command line arguments.
+class Driver {
+public:
+  Driver();
+  ~Driver();
+
+  /// BuildCompilation - Construct a compilation object for a command
+  /// line argument vector.
+  Compilation *BuildCompilation(int argc, const char **argv);
+};
+
+} // end namespace clang
+
+#endif
diff --git a/lib/Driver/Compilation.cpp b/lib/Driver/Compilation.cpp
new file mode 100644 (file)
index 0000000..7f3454b
--- /dev/null
@@ -0,0 +1,21 @@
+//===--- Compilation.cpp - Compilation Task Implementation --------------*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "clang/Driver/Compilation.h"
+using namespace clang;
+
+Compilation::Compilation() {
+}
+
+Compilation::~Compilation() {
+}
+
+int Compilation::Execute() const {
+  return 0;
+}
diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp
new file mode 100644 (file)
index 0000000..7ecc38a
--- /dev/null
@@ -0,0 +1,24 @@
+//===--- Driver.cpp - Clang GCC Compatible Driver -----------------------*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "clang/Driver/Compilation.h"
+#include "clang/Driver/Driver.h"
+using namespace clang;
+
+Driver::Driver() {
+}
+
+Driver::~Driver() {
+}
+
+Compilation *Driver::BuildCompilation(int argc, const char **argv) {
+  return new Compilation();
+}
+
+                                      
diff --git a/lib/Driver/Makefile b/lib/Driver/Makefile
new file mode 100644 (file)
index 0000000..a43033a
--- /dev/null
@@ -0,0 +1,18 @@
+##===- clang/lib/Driver/Makefile ---------------------------*- Makefile -*-===##
+# 
+#                     The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+# 
+##===----------------------------------------------------------------------===##
+
+LEVEL = ../../../..
+LIBRARYNAME := clangDriver
+BUILD_ARCHIVE = 1
+CXXFLAGS = -fno-rtti
+
+CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include
+
+include $(LEVEL)/Makefile.common
+
index 802c91e9432615d80d963c7e9ed57b9c0b536581..50ed94a88d07564a5cd550eec054e3fa2a63ebfa 100755 (executable)
@@ -8,7 +8,8 @@
 ##===----------------------------------------------------------------------===##
 LEVEL = ../../..
 
-PARALLEL_DIRS = Headers Basic Lex Parse AST Sema CodeGen Analysis Rewrite Frontend
+PARALLEL_DIRS = Headers Basic Lex Parse AST Sema CodeGen Analysis Rewrite \
+       Frontend Driver
 
 include $(LEVEL)/Makefile.common
 
index 0fee3f8a11ec028a1bfdda0407baca36ef108870..25a43cdc67e2b85e6d5b9e34b29e874956bcf11e 100644 (file)
@@ -8,6 +8,6 @@
 ##===----------------------------------------------------------------------===##
 
 LEVEL := ../../..
-DIRS := ccc
+DIRS := ccc driver
 
 include $(LEVEL)/Makefile.common
diff --git a/tools/driver/Makefile b/tools/driver/Makefile
new file mode 100644 (file)
index 0000000..88b9309
--- /dev/null
@@ -0,0 +1,21 @@
+##===- tools/driver/Makefile -------------------------------*- Makefile -*-===##
+# 
+#                     The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+# 
+##===----------------------------------------------------------------------===##
+LEVEL = ../../../..
+
+TOOLNAME = clang-driver
+CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include
+CXXFLAGS = -fno-rtti
+
+LINK_COMPONENTS := system
+USEDLIBS = clangDriver.a
+
+# This tool has no plugins, optimize startup time.
+TOOL_NO_EXPORTS = 1
+
+include $(LEVEL)/Makefile.common
diff --git a/tools/driver/driver.cpp b/tools/driver/driver.cpp
new file mode 100644 (file)
index 0000000..7c01e9b
--- /dev/null
@@ -0,0 +1,29 @@
+//===-- driver.cpp - Clang GCC-Compatible Driver --------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This is the entry point to the clang driver; it is a thin
+// wrapper for functionality in the Driver clang library.
+//
+//===----------------------------------------------------------------------===//
+
+#include "clang/Driver/Compilation.h"
+#include "clang/Driver/Driver.h"
+#include "llvm/ADT/OwningPtr.h"
+#include "llvm/System/Signals.h"
+using namespace clang;
+
+int main(int argc, const char **argv) {
+  llvm::sys::PrintStackTraceOnErrorSignal();
+
+  llvm::OwningPtr<Driver> TheDriver(new Driver());
+
+  llvm::OwningPtr<Compilation> C(TheDriver->BuildCompilation(argc, argv));
+
+  return C->Execute();
+}