[cfe-commits] r65867 - in /cfe/trunk: include/clang/Driver/ include/clang/Driver/Compilation.h include/clang/Driver/Driver.h lib/Driver/ lib/Driver/Compilation.cpp lib/Driver/Driver.cpp lib/Driver/Makefile lib/Makefile tools/Makefile tools/driver/ tools/driver/Makefile tools/driver/driver.cpp

Daniel Dunbar daniel at zuster.org
Mon Mar 2 11:59:07 PST 2009


Author: ddunbar
Date: Mon Mar  2 13:59:07 2009
New Revision: 65867

URL: http://llvm.org/viewvc/llvm-project?rev=65867&view=rev
Log:
Stub out some structure for C++ driver.

Added:
    cfe/trunk/include/clang/Driver/
    cfe/trunk/include/clang/Driver/Compilation.h
    cfe/trunk/include/clang/Driver/Driver.h
    cfe/trunk/lib/Driver/   (with props)
    cfe/trunk/lib/Driver/Compilation.cpp
    cfe/trunk/lib/Driver/Driver.cpp
    cfe/trunk/lib/Driver/Makefile
    cfe/trunk/tools/driver/   (with props)
    cfe/trunk/tools/driver/Makefile
    cfe/trunk/tools/driver/driver.cpp
Modified:
    cfe/trunk/lib/Makefile
    cfe/trunk/tools/Makefile

Added: cfe/trunk/include/clang/Driver/Compilation.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Compilation.h?rev=65867&view=auto

==============================================================================
--- cfe/trunk/include/clang/Driver/Compilation.h (added)
+++ cfe/trunk/include/clang/Driver/Compilation.h Mon Mar  2 13:59:07 2009
@@ -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

Added: cfe/trunk/include/clang/Driver/Driver.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Driver.h?rev=65867&view=auto

==============================================================================
--- cfe/trunk/include/clang/Driver/Driver.h (added)
+++ cfe/trunk/include/clang/Driver/Driver.h Mon Mar  2 13:59:07 2009
@@ -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

Propchange: cfe/trunk/lib/Driver/

------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Mar  2 13:59:07 2009
@@ -0,0 +1,4 @@
+Debug
+Debug+Checks
+Release
+Release-Asserts

Added: cfe/trunk/lib/Driver/Compilation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Compilation.cpp?rev=65867&view=auto

==============================================================================
--- cfe/trunk/lib/Driver/Compilation.cpp (added)
+++ cfe/trunk/lib/Driver/Compilation.cpp Mon Mar  2 13:59:07 2009
@@ -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;
+}

Added: cfe/trunk/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=65867&view=auto

==============================================================================
--- cfe/trunk/lib/Driver/Driver.cpp (added)
+++ cfe/trunk/lib/Driver/Driver.cpp Mon Mar  2 13:59:07 2009
@@ -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();
+}
+
+                                      

Added: cfe/trunk/lib/Driver/Makefile
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Makefile?rev=65867&view=auto

==============================================================================
--- cfe/trunk/lib/Driver/Makefile (added)
+++ cfe/trunk/lib/Driver/Makefile Mon Mar  2 13:59:07 2009
@@ -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
+

Modified: cfe/trunk/lib/Makefile
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Makefile?rev=65867&r1=65866&r2=65867&view=diff

==============================================================================
--- cfe/trunk/lib/Makefile (original)
+++ cfe/trunk/lib/Makefile Mon Mar  2 13:59:07 2009
@@ -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
 

Modified: cfe/trunk/tools/Makefile
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/Makefile?rev=65867&r1=65866&r2=65867&view=diff

==============================================================================
--- cfe/trunk/tools/Makefile (original)
+++ cfe/trunk/tools/Makefile Mon Mar  2 13:59:07 2009
@@ -8,6 +8,6 @@
 ##===----------------------------------------------------------------------===##
 
 LEVEL := ../../..
-DIRS := ccc
+DIRS := ccc driver
 
 include $(LEVEL)/Makefile.common

Propchange: cfe/trunk/tools/driver/

------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Mar  2 13:59:07 2009
@@ -0,0 +1,5 @@
+Debug
+Debug+Checks
+Release
+Release-Asserts
+

Added: cfe/trunk/tools/driver/Makefile
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/Makefile?rev=65867&view=auto

==============================================================================
--- cfe/trunk/tools/driver/Makefile (added)
+++ cfe/trunk/tools/driver/Makefile Mon Mar  2 13:59:07 2009
@@ -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

Added: cfe/trunk/tools/driver/driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/driver.cpp?rev=65867&view=auto

==============================================================================
--- cfe/trunk/tools/driver/driver.cpp (added)
+++ cfe/trunk/tools/driver/driver.cpp Mon Mar  2 13:59:07 2009
@@ -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();
+}





More information about the cfe-commits mailing list