[cfe-commits] r126093 - in /cfe/trunk: CMakeLists.txt include/clang/AST/CMakeLists.txt include/clang/Basic/CMakeLists.txt include/clang/Driver/CMakeLists.txt include/clang/Lex/CMakeLists.txt include/clang/Serialization/CMakeLists.txt lib/Headers/CMakeLists.txt lib/StaticAnalyzer/Checkers/CMakeLists.txt
Oscar Fuentes
ofv at wanadoo.es
Sun Feb 20 14:06:33 PST 2011
Author: ofv
Date: Sun Feb 20 16:06:32 2011
New Revision: 126093
URL: http://llvm.org/viewvc/llvm-project?rev=126093&view=rev
Log:
New function for tablegenning: clang_tablegen.
Modified:
cfe/trunk/CMakeLists.txt
cfe/trunk/include/clang/AST/CMakeLists.txt
cfe/trunk/include/clang/Basic/CMakeLists.txt
cfe/trunk/include/clang/Driver/CMakeLists.txt
cfe/trunk/include/clang/Lex/CMakeLists.txt
cfe/trunk/include/clang/Serialization/CMakeLists.txt
cfe/trunk/lib/Headers/CMakeLists.txt
cfe/trunk/lib/StaticAnalyzer/Checkers/CMakeLists.txt
Modified: cfe/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=126093&r1=126092&r2=126093&view=diff
==============================================================================
--- cfe/trunk/CMakeLists.txt (original)
+++ cfe/trunk/CMakeLists.txt Sun Feb 20 16:06:32 2011
@@ -121,6 +121,36 @@
${CLANG_SOURCE_DIR}/include/clang/Config/config.h.cmake
${CLANG_BINARY_DIR}/include/clang/Config/config.h)
+include(LLVMParseArguments)
+
+function(clang_tablegen)
+ # Syntax:
+ # clang_tablegen output-file [tablegen-arg ...] SOURCE source-file
+ # [[TARGET cmake-target-name] [DEPENDS extra-dependency ...]]
+ #
+ # Generates a custom command for invoking tblgen as
+ #
+ # tblgen source-file -o=output-file tablegen-arg ...
+ #
+ # and, if cmake-target-name is provided, creates a custom target for
+ # executing the custom command depending on output-file. It is
+ # possible to list more files to depend after DEPENDS.
+
+ parse_arguments( CTG "SOURCE;TARGET;DEPENDS" "" ${ARGN} )
+
+ if( NOT CTG_SOURCE )
+ message(FATAL_ERROR "SOURCE source-file required by clang_tablegen")
+ endif()
+
+ set( LLVM_TARGET_DEFINITIONS ${CTG_SOURCE} )
+ tablegen( ${CTG_DEFAULT_ARGS} )
+
+ list( GET CTG_DEFAULT_ARGS 0 output_file )
+ if( CTG_TARGET )
+ add_custom_target( ${CTG_TARGET} DEPENDS ${output_file} ${CTG_DEPENDS} )
+ endif()
+endfunction(clang_tablegen)
+
macro(add_clang_library name)
llvm_process_sources(srcs ${ARGN})
if(MSVC_IDE OR XCODE)
Modified: cfe/trunk/include/clang/AST/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/CMakeLists.txt?rev=126093&r1=126092&r2=126093&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/CMakeLists.txt (original)
+++ cfe/trunk/include/clang/AST/CMakeLists.txt Sun Feb 20 16:06:32 2011
@@ -1,24 +1,17 @@
-set(LLVM_TARGET_DEFINITIONS ../Basic/Attr.td)
-tablegen(Attrs.inc
- -gen-clang-attr-classes
- -I ${CMAKE_CURRENT_SOURCE_DIR}/../../)
-add_custom_target(ClangAttrClasses
- DEPENDS Attrs.inc)
+clang_tablegen(Attrs.inc -gen-clang-attr-classes
+ -I ${CMAKE_CURRENT_SOURCE_DIR}/../../
+ SOURCE ../Basic/Attr.td
+ TARGET ClangAttrClasses)
-tablegen(AttrImpl.inc
- -gen-clang-attr-impl
- -I ${CMAKE_CURRENT_SOURCE_DIR}/../../)
-add_custom_target(ClangAttrImpl
- DEPENDS AttrImpl.inc)
+clang_tablegen(AttrImpl.inc -gen-clang-attr-impl
+ -I ${CMAKE_CURRENT_SOURCE_DIR}/../../
+ SOURCE ../Basic/Attr.td
+ TARGET ClangAttrImpl)
-set(LLVM_TARGET_DEFINITIONS ../Basic/StmtNodes.td)
-tablegen(StmtNodes.inc
- -gen-clang-stmt-nodes)
-add_custom_target(ClangStmtNodes
- DEPENDS StmtNodes.inc)
+clang_tablegen(StmtNodes.inc -gen-clang-stmt-nodes
+ SOURCE ../Basic/StmtNodes.td
+ TARGET ClangStmtNodes)
-set(LLVM_TARGET_DEFINITIONS ../Basic/DeclNodes.td)
-tablegen(DeclNodes.inc
- -gen-clang-decl-nodes)
-add_custom_target(ClangDeclNodes
- DEPENDS DeclNodes.inc)
+clang_tablegen(DeclNodes.inc -gen-clang-decl-nodes
+ SOURCE ../Basic/DeclNodes.td
+ TARGET ClangDeclNodes)
Modified: cfe/trunk/include/clang/Basic/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/CMakeLists.txt?rev=126093&r1=126092&r2=126093&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/CMakeLists.txt (original)
+++ cfe/trunk/include/clang/Basic/CMakeLists.txt Sun Feb 20 16:06:32 2011
@@ -1,11 +1,10 @@
macro(clang_diag_gen component)
- tablegen(Diagnostic${component}Kinds.inc
- -gen-clang-diags-defs -clang-component=${component})
- add_custom_target(ClangDiagnostic${component}
- DEPENDS Diagnostic${component}Kinds.inc)
+ clang_tablegen(Diagnostic${component}Kinds.inc
+ -gen-clang-diags-defs -clang-component=${component}
+ SOURCE Diagnostic.td
+ TARGET ClangDiagnostic${component})
endmacro(clang_diag_gen)
-set(LLVM_TARGET_DEFINITIONS Diagnostic.td)
clang_diag_gen(Analysis)
clang_diag_gen(AST)
clang_diag_gen(Common)
@@ -14,19 +13,16 @@
clang_diag_gen(Lex)
clang_diag_gen(Parse)
clang_diag_gen(Sema)
-tablegen(DiagnosticGroups.inc
- -gen-clang-diag-groups)
-add_custom_target(ClangDiagnosticGroups
- DEPENDS DiagnosticGroups.inc)
+clang_tablegen(DiagnosticGroups.inc -gen-clang-diag-groups
+ SOURCE Diagnostic.td
+ TARGET ClangDiagnosticGroups)
-set(LLVM_TARGET_DEFINITIONS Attr.td)
-tablegen(AttrList.inc
- -gen-clang-attr-list
- -I ${CMAKE_CURRENT_SOURCE_DIR}/../../)
-add_custom_target(ClangAttrList
- DEPENDS AttrList.inc)
+clang_tablegen(AttrList.inc -gen-clang-attr-list
+ -I ${CMAKE_CURRENT_SOURCE_DIR}/../../
+ SOURCE Attr.td
+ TARGET ClangAttrList)
# ARM NEON
-set(LLVM_TARGET_DEFINITIONS arm_neon.td)
-tablegen(arm_neon.inc -gen-arm-neon-sema)
-add_custom_target(ClangARMNeon DEPENDS arm_neon.inc)
+clang_tablegen(arm_neon.inc -gen-arm-neon-sema
+ SOURCE arm_neon.td
+ TARGET ClangARMNeon)
Modified: cfe/trunk/include/clang/Driver/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CMakeLists.txt?rev=126093&r1=126092&r2=126093&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/CMakeLists.txt (original)
+++ cfe/trunk/include/clang/Driver/CMakeLists.txt Sun Feb 20 16:06:32 2011
@@ -1,17 +1,11 @@
-set(LLVM_TARGET_DEFINITIONS Options.td)
-tablegen(Options.inc
- -gen-opt-parser-defs)
-add_custom_target(ClangDriverOptions
- DEPENDS Options.inc)
+clang_tablegen(Options.inc -gen-opt-parser-defs
+ SOURCE Options.td
+ TARGET ClangDriverOptions)
-set(LLVM_TARGET_DEFINITIONS CC1Options.td)
-tablegen(CC1Options.inc
- -gen-opt-parser-defs)
-add_custom_target(ClangCC1Options
- DEPENDS CC1Options.inc)
+clang_tablegen(CC1Options.inc -gen-opt-parser-defs
+ SOURCE CC1Options.td
+ TARGET ClangCC1Options)
-set(LLVM_TARGET_DEFINITIONS CC1AsOptions.td)
-tablegen(CC1AsOptions.inc
- -gen-opt-parser-defs)
-add_custom_target(ClangCC1AsOptions
- DEPENDS CC1AsOptions.inc)
+clang_tablegen(CC1AsOptions.inc -gen-opt-parser-defs
+ SOURCE CC1AsOptions.td
+ TARGET ClangCC1AsOptions)
Modified: cfe/trunk/include/clang/Lex/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/CMakeLists.txt?rev=126093&r1=126092&r2=126093&view=diff
==============================================================================
--- cfe/trunk/include/clang/Lex/CMakeLists.txt (original)
+++ cfe/trunk/include/clang/Lex/CMakeLists.txt Sun Feb 20 16:06:32 2011
@@ -1,6 +1,5 @@
-set(LLVM_TARGET_DEFINITIONS ../Basic/Attr.td)
-tablegen(AttrSpellings.inc
- -gen-clang-attr-spelling-list
- -I ${CMAKE_CURRENT_SOURCE_DIR}/../../)
-add_custom_target(ClangAttrSpellings
+clang_tablegen(AttrSpellings.inc -gen-clang-attr-spelling-list
+ -I ${CMAKE_CURRENT_SOURCE_DIR}/../../
+ SOURCE ../Basic/Attr.td
+ TARGET ClangAttrSpellings
DEPENDS AttrSpellings.inc)
Modified: cfe/trunk/include/clang/Serialization/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/CMakeLists.txt?rev=126093&r1=126092&r2=126093&view=diff
==============================================================================
--- cfe/trunk/include/clang/Serialization/CMakeLists.txt (original)
+++ cfe/trunk/include/clang/Serialization/CMakeLists.txt Sun Feb 20 16:06:32 2011
@@ -1,12 +1,9 @@
-set(LLVM_TARGET_DEFINITIONS ../Basic/Attr.td)
-tablegen(AttrPCHRead.inc
- -gen-clang-attr-pch-read
- -I ${CMAKE_CURRENT_SOURCE_DIR}/../../)
-add_custom_target(ClangAttrPCHRead
- DEPENDS AttrPCHRead.inc)
+clang_tablegen(AttrPCHRead.inc -gen-clang-attr-pch-read
+ -I ${CMAKE_CURRENT_SOURCE_DIR}/../../
+ SOURCE ../Basic/Attr.td
+ TARGET ClangAttrPCHRead)
-tablegen(AttrPCHWrite.inc
- -gen-clang-attr-pch-write
- -I ${CMAKE_CURRENT_SOURCE_DIR}/../../)
-add_custom_target(ClangAttrPCHWrite
- DEPENDS AttrPCHWrite.inc)
+clang_tablegen(AttrPCHWrite.inc -gen-clang-attr-pch-write
+ -I ${CMAKE_CURRENT_SOURCE_DIR}/../../
+ SOURCE ../Basic/Attr.td
+ TARGET ClangAttrPCHWrite)
Modified: cfe/trunk/lib/Headers/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/CMakeLists.txt?rev=126093&r1=126092&r2=126093&view=diff
==============================================================================
--- cfe/trunk/lib/Headers/CMakeLists.txt (original)
+++ cfe/trunk/lib/Headers/CMakeLists.txt Sun Feb 20 16:06:32 2011
@@ -28,8 +28,8 @@
endif()
# Generate arm_neon.h
-set(LLVM_TARGET_DEFINITIONS ${CLANG_SOURCE_DIR}/include/clang/Basic/arm_neon.td)
-tablegen(arm_neon.h.inc -gen-arm-neon)
+clang_tablegen(arm_neon.h.inc -gen-arm-neon
+ SOURCE ${CLANG_SOURCE_DIR}/include/clang/Basic/arm_neon.td)
set(out_files)
foreach( f ${files} )
Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/CMakeLists.txt?rev=126093&r1=126092&r2=126093&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/CMakeLists.txt (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/CMakeLists.txt Sun Feb 20 16:06:32 2011
@@ -1,9 +1,7 @@
-set(LLVM_TARGET_DEFINITIONS Checkers.td)
-tablegen(Checkers.inc
- -gen-clang-sa-checkers
- -I ${CMAKE_CURRENT_SOURCE_DIR}/../../../include)
-add_custom_target(ClangSACheckers
- DEPENDS Checkers.inc)
+clang_tablegen(Checkers.inc -gen-clang-sa-checkers
+ -I ${CMAKE_CURRENT_SOURCE_DIR}/../../../include
+ SOURCE Checkers.td
+ TARGET ClangSACheckers)
set(LLVM_USED_LIBS clangBasic clangAST)
More information about the cfe-commits
mailing list