Build system changes to use TableGen to generate the various
diagnostics. This builds on the patch that Sebastian committed and
then revert. Major differences are:
- We don't remove or use the current ".def" files. Instead, for now,
we just make sure that we're building the ".inc" files.
- Fixed CMake makefiles to run TableGen and build the ".inc" files
when needed. Tested with both the Xcode and Makefile generators
provided by CMake, so it should be solid.
- Fixed normal makefiles to handle out-of-source builds that involve
the ".inc" files.
I'll send a separate patch to the list with Sebastian's changes that
eliminate the use of the .def files.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67058 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3575d88..6a46c5a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -12,6 +12,7 @@
if( LLVM_COMMON_DEPENDS )
add_dependencies( ${name} ${LLVM_COMMON_DEPENDS} )
endif( LLVM_COMMON_DEPENDS )
+ add_dependencies(${name} ClangDiagnosticCommon)
if(MSVC)
get_target_property(cflag ${name} COMPILE_FLAGS)
if(NOT cflag)
@@ -38,6 +39,7 @@
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/include
+ ${CMAKE_CURRENT_BINARY_DIR}/include
)
install(DIRECTORY include
@@ -47,6 +49,7 @@
add_definitions( -D_GNU_SOURCE )
+add_subdirectory(include)
add_subdirectory(lib)
add_subdirectory(Driver)
diff --git a/Driver/Makefile b/Driver/Makefile
index 84a484e..962e3fd 100644
--- a/Driver/Makefile
+++ b/Driver/Makefile
@@ -1,6 +1,6 @@
LEVEL = ../../..
TOOLNAME = clang
-CPPFLAGS += -I$(PROJ_SRC_DIR)/../include
+CPPFLAGS += -I$(PROJ_SRC_DIR)/../include -I$(PROJ_OBJ_DIR)/../include
CXXFLAGS = -fno-rtti
# Clang has no plugins, optimize startup time.
diff --git a/Makefile b/Makefile
index 72bfaa7..660f0e9 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
LEVEL = ../..
-DIRS := lib Driver docs tools
+DIRS := include lib Driver docs tools
include $(LEVEL)/Makefile.common
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
new file mode 100644
index 0000000..253a09b
--- /dev/null
+++ b/include/CMakeLists.txt
@@ -0,0 +1 @@
+add_subdirectory(clang)
diff --git a/include/Makefile b/include/Makefile
new file mode 100644
index 0000000..47daabc
--- /dev/null
+++ b/include/Makefile
@@ -0,0 +1,4 @@
+LEVEL = ../../..
+DIRS := clang
+
+include $(LEVEL)/Makefile.common
diff --git a/include/clang/Basic/CMakeLists.txt b/include/clang/Basic/CMakeLists.txt
new file mode 100644
index 0000000..9d6e14f
--- /dev/null
+++ b/include/clang/Basic/CMakeLists.txt
@@ -0,0 +1,16 @@
+macro(clang_diag_gen component)
+ tablegen(Diagnostic${component}Kinds.inc
+ -gen-clang-diags-defs -clang-component=${component})
+ add_custom_target(ClangDiagnostic${component}
+ DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/Diagnostic${component}Kinds.inc)
+endmacro(clang_diag_gen)
+
+set(LLVM_TARGET_DEFINITIONS Diagnostic.td)
+clang_diag_gen(Analysis)
+clang_diag_gen(AST)
+clang_diag_gen(Common)
+clang_diag_gen(Driver)
+clang_diag_gen(Frontend)
+clang_diag_gen(Lex)
+clang_diag_gen(Parse)
+clang_diag_gen(Sema)
\ No newline at end of file
diff --git a/include/clang/Basic/Makefile b/include/clang/Basic/Makefile
new file mode 100644
index 0000000..3919311
--- /dev/null
+++ b/include/clang/Basic/Makefile
@@ -0,0 +1,9 @@
+LEVEL = ../../../../..
+BUILT_SOURCES = DiagnosticAnalysisKinds.inc DiagnosticASTKinds.inc \
+ DiagnosticCommonKinds.inc DiagnosticDriverKinds.inc \
+ DiagnosticFrontendKinds.inc DiagnosticLexKinds.inc \
+ DiagnosticParseKinds.inc DiagnosticSemaKinds.inc
+
+CLANG_BUILD_DIAGNOSTICS_INC = 1
+
+include $(LEVEL)/Makefile.common
diff --git a/include/clang/CMakeLists.txt b/include/clang/CMakeLists.txt
new file mode 100644
index 0000000..39e3698
--- /dev/null
+++ b/include/clang/CMakeLists.txt
@@ -0,0 +1 @@
+add_subdirectory(Basic)
diff --git a/include/clang/Makefile b/include/clang/Makefile
new file mode 100644
index 0000000..82a16d5
--- /dev/null
+++ b/include/clang/Makefile
@@ -0,0 +1,4 @@
+LEVEL = ../../../..
+DIRS := Basic
+
+include $(LEVEL)/Makefile.common
diff --git a/lib/AST/CMakeLists.txt b/lib/AST/CMakeLists.txt
index 9687f34..48b1971 100644
--- a/lib/AST/CMakeLists.txt
+++ b/lib/AST/CMakeLists.txt
@@ -29,3 +29,5 @@
Type.cpp
TypeSerialization.cpp
)
+
+add_dependencies(clangAST ClangDiagnosticAST)
diff --git a/lib/AST/Makefile b/lib/AST/Makefile
index cdfc64c..f7d4e9f 100644
--- a/lib/AST/Makefile
+++ b/lib/AST/Makefile
@@ -16,7 +16,7 @@
BUILD_ARCHIVE = 1
CXXFLAGS = -fno-rtti
-CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include
+CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include
include $(LEVEL)/Makefile.common
diff --git a/lib/Analysis/CMakeLists.txt b/lib/Analysis/CMakeLists.txt
index 64aa3a4..72bc3ae 100644
--- a/lib/Analysis/CMakeLists.txt
+++ b/lib/Analysis/CMakeLists.txt
@@ -31,3 +31,5 @@
SymbolManager.cpp
UninitializedValues.cpp
)
+
+add_dependencies(clangAnalysis ClangDiagnosticAnalysis)
diff --git a/lib/Analysis/Makefile b/lib/Analysis/Makefile
index b1d9178..c597254 100644
--- a/lib/Analysis/Makefile
+++ b/lib/Analysis/Makefile
@@ -16,7 +16,7 @@
BUILD_ARCHIVE = 1
CXXFLAGS = -fno-rtti
-CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include
+CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include
include $(LEVEL)/Makefile.common
diff --git a/lib/Basic/CMakeLists.txt b/lib/Basic/CMakeLists.txt
index 37fa210..2656859 100644
--- a/lib/Basic/CMakeLists.txt
+++ b/lib/Basic/CMakeLists.txt
@@ -11,3 +11,13 @@
Targets.cpp
TokenKinds.cpp
)
+
+add_dependencies(clangBasic
+ ClangDiagnosticAnalysis
+ ClangDiagnosticAST
+ ClangDiagnosticCommon
+ ClangDiagnosticDriver
+ ClangDiagnosticFrontend
+ ClangDiagnosticLex
+ ClangDiagnosticParse
+ ClangDiagnosticSema)
diff --git a/lib/Basic/Makefile b/lib/Basic/Makefile
index e95d6db..3fd6c2c 100644
--- a/lib/Basic/Makefile
+++ b/lib/Basic/Makefile
@@ -16,7 +16,7 @@
BUILD_ARCHIVE = 1
CXXFLAGS = -fno-rtti
-CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include
+CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include
include $(LEVEL)/Makefile.common
diff --git a/lib/CodeGen/Makefile b/lib/CodeGen/Makefile
index 4d7828e..e716fe7 100644
--- a/lib/CodeGen/Makefile
+++ b/lib/CodeGen/Makefile
@@ -17,7 +17,7 @@
BUILD_ARCHIVE = 1
CXXFLAGS = -fno-rtti
-CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include
+CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include
include $(LEVEL)/Makefile.common
diff --git a/lib/Driver/Makefile b/lib/Driver/Makefile
index a43033a..fb437d2 100644
--- a/lib/Driver/Makefile
+++ b/lib/Driver/Makefile
@@ -12,7 +12,7 @@
BUILD_ARCHIVE = 1
CXXFLAGS = -fno-rtti
-CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include
+CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include
include $(LEVEL)/Makefile.common
diff --git a/lib/Frontend/Makefile b/lib/Frontend/Makefile
index 70edfd5..8d70847 100644
--- a/lib/Frontend/Makefile
+++ b/lib/Frontend/Makefile
@@ -12,7 +12,7 @@
BUILD_ARCHIVE = 1
CXXFLAGS = -fno-rtti
-CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include
+CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include
include $(LEVEL)/Makefile.common
diff --git a/lib/Lex/CMakeLists.txt b/lib/Lex/CMakeLists.txt
index 6347142..a7237a7 100644
--- a/lib/Lex/CMakeLists.txt
+++ b/lib/Lex/CMakeLists.txt
@@ -22,3 +22,5 @@
TokenLexer.cpp
TokenConcatenation.cpp
)
+
+add_dependencies(clangLex ClangDiagnosticLex)
diff --git a/lib/Lex/Makefile b/lib/Lex/Makefile
index 187448c..a2437da 100644
--- a/lib/Lex/Makefile
+++ b/lib/Lex/Makefile
@@ -22,7 +22,7 @@
CXXFLAGS += -maltivec
endif
-CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include
+CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include
include $(LEVEL)/Makefile.common
diff --git a/lib/Parse/CMakeLists.txt b/lib/Parse/CMakeLists.txt
index 9135584..8fb7cd2 100644
--- a/lib/Parse/CMakeLists.txt
+++ b/lib/Parse/CMakeLists.txt
@@ -17,3 +17,5 @@
ParseTentative.cpp
ParseTemplate.cpp
)
+
+add_dependencies(clangParse ClangDiagnosticParse)
diff --git a/lib/Parse/Makefile b/lib/Parse/Makefile
index b5d2653..5d69029 100644
--- a/lib/Parse/Makefile
+++ b/lib/Parse/Makefile
@@ -16,7 +16,7 @@
BUILD_ARCHIVE = 1
CXXFLAGS = -fno-rtti
-CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include
+CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include
include $(LEVEL)/Makefile.common
diff --git a/lib/Rewrite/Makefile b/lib/Rewrite/Makefile
index 3c0b5a5..61fdf40 100644
--- a/lib/Rewrite/Makefile
+++ b/lib/Rewrite/Makefile
@@ -16,7 +16,7 @@
BUILD_ARCHIVE = 1
CXXFLAGS = -fno-rtti
-CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include
+CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include
include $(LEVEL)/Makefile.common
diff --git a/lib/Sema/CMakeLists.txt b/lib/Sema/CMakeLists.txt
index 23809b9..e90c7e3 100644
--- a/lib/Sema/CMakeLists.txt
+++ b/lib/Sema/CMakeLists.txt
@@ -24,3 +24,5 @@
SemaTemplateInstantiate.cpp
SemaType.cpp
)
+
+add_dependencies(clangSema ClangDiagnosticSema)
diff --git a/lib/Sema/Makefile b/lib/Sema/Makefile
index 9193a54..0f4c796 100644
--- a/lib/Sema/Makefile
+++ b/lib/Sema/Makefile
@@ -17,7 +17,7 @@
BUILD_ARCHIVE = 1
CXXFLAGS = -fno-rtti
-CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include
+CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include
include $(LEVEL)/Makefile.common
diff --git a/tools/driver/Makefile b/tools/driver/Makefile
index ca2253a..0ba65e5 100644
--- a/tools/driver/Makefile
+++ b/tools/driver/Makefile
@@ -9,7 +9,7 @@
LEVEL = ../../../..
TOOLNAME = clang-driver
-CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include
+CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include
CXXFLAGS = -fno-rtti
# FIXME: It is unfortunate we need to pull in the bitcode reader and