Move ExecuteCompilerInvocation to a new library FrontendTool
authorPeter Collingbourne <peter@pcc.me.uk>
Tue, 24 Aug 2010 00:31:22 +0000 (00:31 +0000)
committerPeter Collingbourne <peter@pcc.me.uk>
Tue, 24 Aug 2010 00:31:22 +0000 (00:31 +0000)
r110903 introduced a dependency from Frontend to every library that
declared an Action by introducing Action references that previously
resided in the driver in the file ExecuteCompilerInvocation.cpp.
This patch moves ExecuteCompilerInvocation to a new library named
FrontendTool which is intended to bear these dependencies.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111873 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Frontend/Utils.h
include/clang/FrontendTool/Utils.h [new file with mode: 0644]
lib/CMakeLists.txt
lib/Frontend/CMakeLists.txt
lib/FrontendTool/CMakeLists.txt [new file with mode: 0644]
lib/FrontendTool/ExecuteCompilerInvocation.cpp [moved from lib/Frontend/ExecuteCompilerInvocation.cpp with 99% similarity]
lib/FrontendTool/Makefile [new file with mode: 0644]
lib/Makefile
tools/driver/CMakeLists.txt
tools/driver/Makefile
tools/driver/cc1_main.cpp

index cd6ffb0f7197ec5bf8fa34bf43fc6928b48080a1..fe722db381d0106b1379f3872fb45f7a7f90dc1f 100644 (file)
@@ -77,13 +77,6 @@ void AttachDependencyFileGen(Preprocessor &PP,
 /// a seekable stream.
 void CacheTokens(Preprocessor &PP, llvm::raw_fd_ostream* OS);
 
-
-/// ExecuteCompilerInvocation - Execute the given actions described by the
-/// compiler invocation object in the given compiler instance.
-///
-/// \return - True on success.
-bool ExecuteCompilerInvocation(CompilerInstance *Clang);
-
 }  // end namespace clang
 
 #endif
diff --git a/include/clang/FrontendTool/Utils.h b/include/clang/FrontendTool/Utils.h
new file mode 100644 (file)
index 0000000..031ee7d
--- /dev/null
@@ -0,0 +1,30 @@
+//===--- Utils.h - Misc utilities for the front-end -------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+//  This header contains miscellaneous utilities for various front-end actions
+//  which were split from Frontend to minimise Frontend's dependencies.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_CLANG_FRONTENDTOOL_UTILS_H
+#define LLVM_CLANG_FRONTENDTOOL_UTILS_H
+
+namespace clang {
+
+class CompilerInstance;
+
+/// ExecuteCompilerInvocation - Execute the given actions described by the
+/// compiler invocation object in the given compiler instance.
+///
+/// \return - True on success.
+bool ExecuteCompilerInvocation(CompilerInstance *Clang);
+
+}  // end namespace clang
+
+#endif
index 8ecfcbea29b28cb517415bbb6371b5faccff92b5..bd5e342e028f450d3d4a335af8f2af5c9e0db25f 100644 (file)
@@ -10,5 +10,6 @@ add_subdirectory(Rewrite)
 add_subdirectory(Driver)
 add_subdirectory(Serialization)
 add_subdirectory(Frontend)
+add_subdirectory(FrontendTool)
 add_subdirectory(Index)
 add_subdirectory(Checker)
index e5463893c7463c33a4461a09979b31f25ee768eb..5a31495397aec51f5d21a213fb0d8aa303ed6dac 100644 (file)
@@ -12,7 +12,6 @@ add_clang_library(clangFrontend
   DependencyFile.cpp
   DiagChecker.cpp
   DocumentXML.cpp
-  ExecuteCompilerInvocation.cpp
   FrontendAction.cpp
   FrontendActions.cpp
   FrontendOptions.cpp
diff --git a/lib/FrontendTool/CMakeLists.txt b/lib/FrontendTool/CMakeLists.txt
new file mode 100644 (file)
index 0000000..26c9fc7
--- /dev/null
@@ -0,0 +1,5 @@
+set(LLVM_NO_RTTI 1)
+
+add_clang_library(clangFrontendTool
+  ExecuteCompilerInvocation.cpp
+  )
similarity index 99%
rename from lib/Frontend/ExecuteCompilerInvocation.cpp
rename to lib/FrontendTool/ExecuteCompilerInvocation.cpp
index b432e8f6b66bb55c27ac7a14c87ef1ac77298504..63c6287807626126ede7c818cd924af6bb850474 100644 (file)
@@ -12,7 +12,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "clang/Frontend/Utils.h"
+#include "clang/FrontendTool/Utils.h"
 #include "clang/Checker/FrontendActions.h"
 #include "clang/CodeGen/CodeGenAction.h"
 #include "clang/Driver/CC1Options.h"
diff --git a/lib/FrontendTool/Makefile b/lib/FrontendTool/Makefile
new file mode 100644 (file)
index 0000000..c43213f
--- /dev/null
@@ -0,0 +1,13 @@
+##===- clang/lib/FrontendTool/Makefile ---------------------*- Makefile -*-===##
+#
+#                     The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+
+CLANG_LEVEL := ../..
+LIBRARYNAME := clangFrontendTool
+
+include $(CLANG_LEVEL)/Makefile
index 843b5740bb185c9ddf2eb6559f765a0ebe48bc04..dbd0eb699ee1a1fc5b46f260d77fa9a45cba2f71 100755 (executable)
@@ -9,7 +9,7 @@
 CLANG_LEVEL := ..
 
 PARALLEL_DIRS = Headers Basic Lex Parse AST Sema CodeGen Analysis \
-                Checker Rewrite Serialization Frontend Index Driver
+                Checker Rewrite Serialization Frontend FrontendTool Index Driver
 
 include $(CLANG_LEVEL)/Makefile
 
index 5ca6fa1993e8edd89265a019908cdbbf7c21dbc0..ec6e9c6e8026c0879bb5226722759d8eddc0d536 100644 (file)
@@ -1,6 +1,7 @@
 set(LLVM_NO_RTTI 1)
 
 set( LLVM_USED_LIBS
+  clangFrontendTool
   clangFrontend
   clangDriver
   clangSerialization
index 0fc0d6597c3c8c6cb6b2c1749c1cac1721128ddc..447f0e4eb06beb822e7c8f5ae3e3ebe5b5b51291 100644 (file)
@@ -27,9 +27,10 @@ include $(CLANG_LEVEL)/../../Makefile.config
 
 LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader bitwriter codegen \
                    ipo selectiondag
-USEDLIBS = clangFrontend.a clangDriver.a clangSerialization.a clangCodeGen.a \
-           clangParse.a clangSema.a clangChecker.a clangAnalysis.a \
-          clangIndex.a clangRewrite.a clangAST.a clangLex.a clangBasic.a
+USEDLIBS = clangFrontendTool.a clangFrontend.a clangDriver.a \
+           clangSerialization.a clangCodeGen.a clangParse.a clangSema.a \
+           clangChecker.a clangAnalysis.a clangIndex.a clangRewrite.a \
+           clangAST.a clangLex.a clangBasic.a
 
 include $(CLANG_LEVEL)/Makefile
 
index 2cab8da24bede0019ae58858ee2924552bce60d8..de5e8bf043bf26b47375809662899ad6175c5377 100644 (file)
@@ -23,7 +23,7 @@
 #include "clang/Frontend/FrontendDiagnostic.h"
 #include "clang/Frontend/TextDiagnosticBuffer.h"
 #include "clang/Frontend/TextDiagnosticPrinter.h"
-#include "clang/Frontend/Utils.h"
+#include "clang/FrontendTool/Utils.h"
 #include "llvm/LLVMContext.h"
 #include "llvm/ADT/Statistic.h"
 #include "llvm/Support/ErrorHandling.h"