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
This commit is contained in:
Douglas Gregor 2009-03-16 23:06:59 +00:00
Родитель 8c84417776
Коммит a393e9eedc
26 изменённых файлов: 71 добавлений и 13 удалений

Просмотреть файл

@ -12,6 +12,7 @@ macro(add_clang_library name)
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 @@ endmacro(add_clang_executable)
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/include
${CMAKE_CURRENT_BINARY_DIR}/include
)
install(DIRECTORY include
@ -47,6 +49,7 @@ install(DIRECTORY include
add_definitions( -D_GNU_SOURCE )
add_subdirectory(include)
add_subdirectory(lib)
add_subdirectory(Driver)

Просмотреть файл

@ -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.

Просмотреть файл

@ -1,5 +1,5 @@
LEVEL = ../..
DIRS := lib Driver docs tools
DIRS := include lib Driver docs tools
include $(LEVEL)/Makefile.common

1
include/CMakeLists.txt Normal file
Просмотреть файл

@ -0,0 +1 @@
add_subdirectory(clang)

4
include/Makefile Normal file
Просмотреть файл

@ -0,0 +1,4 @@
LEVEL = ../../..
DIRS := clang
include $(LEVEL)/Makefile.common

Просмотреть файл

@ -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)

Просмотреть файл

@ -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

Просмотреть файл

@ -0,0 +1 @@
add_subdirectory(Basic)

4
include/clang/Makefile Normal file
Просмотреть файл

@ -0,0 +1,4 @@
LEVEL = ../../../..
DIRS := Basic
include $(LEVEL)/Makefile.common

Просмотреть файл

@ -29,3 +29,5 @@ add_clang_library(clangAST
Type.cpp
TypeSerialization.cpp
)
add_dependencies(clangAST ClangDiagnosticAST)

Просмотреть файл

@ -16,7 +16,7 @@ LIBRARYNAME := clangAST
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

Просмотреть файл

@ -31,3 +31,5 @@ add_clang_library(clangAnalysis
SymbolManager.cpp
UninitializedValues.cpp
)
add_dependencies(clangAnalysis ClangDiagnosticAnalysis)

Просмотреть файл

@ -16,7 +16,7 @@ LIBRARYNAME := clangAnalysis
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

Просмотреть файл

@ -11,3 +11,13 @@ add_clang_library(clangBasic
Targets.cpp
TokenKinds.cpp
)
add_dependencies(clangBasic
ClangDiagnosticAnalysis
ClangDiagnosticAST
ClangDiagnosticCommon
ClangDiagnosticDriver
ClangDiagnosticFrontend
ClangDiagnosticLex
ClangDiagnosticParse
ClangDiagnosticSema)

Просмотреть файл

@ -16,7 +16,7 @@ LIBRARYNAME := clangBasic
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

Просмотреть файл

@ -17,7 +17,7 @@ LIBRARYNAME := clangCodeGen
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

Просмотреть файл

@ -12,7 +12,7 @@ LIBRARYNAME := clangDriver
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

Просмотреть файл

@ -12,7 +12,7 @@ LIBRARYNAME := clangFrontend
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

Просмотреть файл

@ -22,3 +22,5 @@ add_clang_library(clangLex
TokenLexer.cpp
TokenConcatenation.cpp
)
add_dependencies(clangLex ClangDiagnosticLex)

Просмотреть файл

@ -22,7 +22,7 @@ ifeq ($(ARCH),PowerPC)
CXXFLAGS += -maltivec
endif
CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include
CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include
include $(LEVEL)/Makefile.common

Просмотреть файл

@ -17,3 +17,5 @@ add_clang_library(clangParse
ParseTentative.cpp
ParseTemplate.cpp
)
add_dependencies(clangParse ClangDiagnosticParse)

Просмотреть файл

@ -16,7 +16,7 @@ LIBRARYNAME := clangParse
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

Просмотреть файл

@ -16,7 +16,7 @@ LIBRARYNAME := clangRewrite
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

Просмотреть файл

@ -24,3 +24,5 @@ add_clang_library(clangSema
SemaTemplateInstantiate.cpp
SemaType.cpp
)
add_dependencies(clangSema ClangDiagnosticSema)

Просмотреть файл

@ -17,7 +17,7 @@ LIBRARYNAME := clangSema
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

Просмотреть файл

@ -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