1
0
Эх сурвалжийг харах

Merge topic 'yacclex-clang-tidy'

7f4eaf23 LexerParser: disable clang-tidy checks
9bad0dfc LexerParser: move to custom directory
8927e913 CMakeLists: remove option to regenerate yacc/lex

Acked-by: Kitware Robot <[email protected]>
Merge-request: !775
Brad King 8 жил өмнө
parent
commit
e80e8eb609
31 өөрчлөгдсөн 71 нэмэгдсэн , 96 устгасан
  1. 0 18
      Source/.gitattributes
  2. 29 66
      Source/CMakeLists.txt
  3. 6 0
      Source/LexerParser/.clang-tidy
  4. 17 0
      Source/LexerParser/.gitattributes
  5. 0 0
      Source/LexerParser/cmCommandArgumentLexer.cxx
  6. 0 0
      Source/LexerParser/cmCommandArgumentLexer.h
  7. 0 0
      Source/LexerParser/cmCommandArgumentLexer.in.l
  8. 0 0
      Source/LexerParser/cmCommandArgumentParser.cxx
  9. 0 1
      Source/LexerParser/cmCommandArgumentParser.y
  10. 0 0
      Source/LexerParser/cmCommandArgumentParserTokens.h
  11. 0 0
      Source/LexerParser/cmDependsJavaLexer.cxx
  12. 0 0
      Source/LexerParser/cmDependsJavaLexer.h
  13. 0 0
      Source/LexerParser/cmDependsJavaLexer.in.l
  14. 0 0
      Source/LexerParser/cmDependsJavaParser.cxx
  15. 1 2
      Source/LexerParser/cmDependsJavaParser.y
  16. 0 0
      Source/LexerParser/cmDependsJavaParserTokens.h
  17. 0 0
      Source/LexerParser/cmExprLexer.cxx
  18. 0 0
      Source/LexerParser/cmExprLexer.h
  19. 0 0
      Source/LexerParser/cmExprLexer.in.l
  20. 0 1
      Source/LexerParser/cmExprParser.cxx
  21. 0 1
      Source/LexerParser/cmExprParser.y
  22. 0 0
      Source/LexerParser/cmExprParserTokens.h
  23. 0 0
      Source/LexerParser/cmFortranLexer.cxx
  24. 0 0
      Source/LexerParser/cmFortranLexer.h
  25. 0 0
      Source/LexerParser/cmFortranLexer.in.l
  26. 0 0
      Source/LexerParser/cmFortranParser.cxx
  27. 0 0
      Source/LexerParser/cmFortranParser.y
  28. 0 0
      Source/LexerParser/cmFortranParserTokens.h
  29. 0 0
      Source/LexerParser/cmListFileLexer.c
  30. 0 0
      Source/LexerParser/cmListFileLexer.in.l
  31. 18 7
      bootstrap

+ 0 - 18
Source/.gitattributes

@@ -1,20 +1,2 @@
-/cmCommandArgumentLexer.cxx        generated
-/cmCommandArgumentLexer.h          generated
-/cmCommandArgumentParser.cxx       generated
-/cmCommandArgumentParserTokens.h   generated
-/cmDependsJavaLexer.cxx            generated
-/cmDependsJavaLexer.h              generated
-/cmDependsJavaParser.cxx           generated
-/cmDependsJavaParserTokens.h       generated
-/cmExprLexer.cxx                   generated
-/cmExprLexer.h                     generated
-/cmExprParser.cxx                  generated
-/cmExprParserTokens.h              generated
-/cmFortranLexer.cxx                generated
-/cmFortranLexer.h                  generated
-/cmFortranParser.cxx               generated
-/cmFortranParserTokens.h           generated
-/cmListFileLexer.c                 generated
-
 # Do not format third-party sources.
 /kwsys/**                                  -format.clang-format

+ 29 - 66
Source/CMakeLists.txt

@@ -78,6 +78,7 @@ configure_file(
 include_directories(
   "${CMake_BINARY_DIR}/Source"
   "${CMake_SOURCE_DIR}/Source"
+  "${CMake_SOURCE_DIR}/Source/LexerParser"
   ${CMAKE_ZLIB_INCLUDES}
   ${CMAKE_EXPAT_INCLUDES}
   ${CMAKE_TAR_INCLUDES}
@@ -88,61 +89,6 @@ include_directories(
 # let cmake know it is supposed to use it
 add_definitions(-DCMAKE_BUILD_WITH_CMAKE)
 
-option(CMAKE_REGENERATE_YACCLEX
-  "Regenerate YACC and LEXX files" OFF)
-mark_as_advanced(CMAKE_REGENERATE_YACCLEX)
-if(CMAKE_REGENERATE_YACCLEX)
-  set(parsersLexers cmFortran cmCommandArgument cmExpr)
-  find_program(YACC_EXECUTABLE
-    NAMES yacc bison
-    PATHS /usr/bin
-    DOC "Yacc or Bison executable")
-  find_program(FLEX_EXECUTABLE
-    NAMES flex
-    PATHS /usr/bin
-    DOC "Flex executable")
-  mark_as_advanced(YACC_EXECUTABLE FLEX_EXECUTABLE)
-  if(YACC_EXECUTABLE)
-    set(BISON_FLAGS)
-    if(YACC_EXECUTABLE MATCHES "bison")
-      set(BISON_FLAGS "--yacc")
-    endif()
-    set(yacc_files)
-    foreach(name ${parsersLexers})
-      set(src "${CMAKE_CURRENT_SOURCE_DIR}/${name}Parser.y")
-      set(dst "${CMAKE_CURRENT_BINARY_DIR}/${name}Parser.cxx")
-      set(hdr "${CMAKE_CURRENT_BINARY_DIR}/${name}ParserTokens.h")
-      add_custom_command(
-        OUTPUT "${dst}"
-        DEPENDS "${src}"
-        COMMAND
-        ${YACC_EXECUTABLE}
-        --name-prefix=${name}_yy --defines=${hdr} -o${dst} ${src}
-        )
-      set(yacc_files ${yacc_files} "${dst}")
-    endforeach()
-    add_custom_target(RerunYacc DEPENDS ${yacc_files})
-  endif()
-  if(FLEX_EXECUTABLE)
-    set(lex_files)
-    foreach(name ${parsersLexers})
-      set(src "${CMAKE_CURRENT_SOURCE_DIR}/${name}Lexer.in.l")
-      set(dst "${CMAKE_CURRENT_BINARY_DIR}/${name}Lexer.cxx")
-      set(hdr "${CMAKE_CURRENT_BINARY_DIR}/${name}Lexer.h")
-      add_custom_command(
-        OUTPUT "${dst}"
-        DEPENDS "${src}"
-        COMMAND
-        ${FLEX_EXECUTABLE}
-        --prefix=${name}_yy --header-file=${hdr} -o${dst} ${src}
-        )
-      set(lex_files ${lex_files} "${dst}")
-    endforeach()
-    add_custom_target(RerunLex DEPENDS ${lex_files})
-  endif()
-
-endif()
-
 # Check if we can build the ELF parser.
 if(CMAKE_USE_ELF_PARSER)
   set(ELF_SRCS cmELF.h cmELF.cxx)
@@ -157,14 +103,40 @@ endif()
 # Sources for CMakeLib
 #
 set(SRCS
+  # Lexers/Parsers
+  LexerParser/cmCommandArgumentLexer.cxx
+  LexerParser/cmCommandArgumentLexer.h
+  LexerParser/cmCommandArgumentLexer.in.l
+  LexerParser/cmCommandArgumentParser.cxx
+  LexerParser/cmCommandArgumentParserTokens.h
+  LexerParser/cmCommandArgumentParser.y
+  LexerParser/cmDependsJavaLexer.cxx
+  LexerParser/cmDependsJavaLexer.h
+  LexerParser/cmDependsJavaLexer.in.l
+  LexerParser/cmDependsJavaParser.cxx
+  LexerParser/cmDependsJavaParserTokens.h
+  LexerParser/cmDependsJavaParser.y
+  LexerParser/cmExprLexer.cxx
+  LexerParser/cmExprLexer.h
+  LexerParser/cmExprLexer.in.l
+  LexerParser/cmExprParser.cxx
+  LexerParser/cmExprParserTokens.h
+  LexerParser/cmExprParser.y
+  LexerParser/cmFortranLexer.cxx
+  LexerParser/cmFortranLexer.h
+  LexerParser/cmFortranLexer.in.l
+  LexerParser/cmFortranParser.cxx
+  LexerParser/cmFortranParserTokens.h
+  LexerParser/cmFortranParser.y
+  LexerParser/cmListFileLexer.c
+  LexerParser/cmListFileLexer.in.l
+
   cmArchiveWrite.cxx
   cmBase32.cxx
   cmCacheManager.cxx
   cmCacheManager.h
   cmCLocaleEnvironmentScope.h
   cmCLocaleEnvironmentScope.cxx
-  cmCommandArgumentLexer.cxx
-  cmCommandArgumentParser.cxx
   cmCommandArgumentParserHelper.cxx
   cmCommonTargetGenerator.cxx
   cmCommonTargetGenerator.h
@@ -196,8 +168,6 @@ set(SRCS
   cmDependsFortran.h
   cmDependsJava.cxx
   cmDependsJava.h
-  cmDependsJavaLexer.cxx
-  cmDependsJavaParser.cxx
   cmDependsJavaParserHelper.cxx
   cmDependsJavaParserHelper.h
   cmDocumentation.cxx
@@ -206,8 +176,6 @@ set(SRCS
   cmDynamicLoader.cxx
   cmDynamicLoader.h
   ${ELF_SRCS}
-  cmExprLexer.cxx
-  cmExprParser.cxx
   cmExprParserHelper.cxx
   cmExportBuildAndroidMKGenerator.h
   cmExportBuildAndroidMKGenerator.cxx
@@ -247,10 +215,6 @@ set(SRCS
   cmFilePathChecksum.h
   cmFileTimeComparison.cxx
   cmFileTimeComparison.h
-  cmFortranLexer.cxx
-  cmFortranLexer.h
-  cmFortranParser.cxx
-  cmFortranParser.h
   cmFortranParserImpl.cxx
   cmGeneratedFileStream.cxx
   cmGeneratorExpressionContext.cxx
@@ -302,7 +266,6 @@ set(SRCS
   cmLinkLineDeviceComputer.h
   cmListFileCache.cxx
   cmListFileCache.h
-  cmListFileLexer.c
   cmLocalCommonGenerator.cxx
   cmLocalCommonGenerator.h
   cmLocalGenerator.cxx

+ 6 - 0
Source/LexerParser/.clang-tidy

@@ -0,0 +1,6 @@
+---
+# We want to disable all checks for generated code.  However, clang-tidy will
+# assume we did not configure it correctly.  Just add one check that will never
+# be found.
+Checks: '-*,llvm-twine-local'
+...

+ 17 - 0
Source/LexerParser/.gitattributes

@@ -0,0 +1,17 @@
+/cmCommandArgumentLexer.cxx        generated
+/cmCommandArgumentLexer.h          generated
+/cmCommandArgumentParser.cxx       generated
+/cmCommandArgumentParserTokens.h   generated
+/cmDependsJavaLexer.cxx            generated
+/cmDependsJavaLexer.h              generated
+/cmDependsJavaParser.cxx           generated
+/cmDependsJavaParserTokens.h       generated
+/cmExprLexer.cxx                   generated
+/cmExprLexer.h                     generated
+/cmExprParser.cxx                  generated
+/cmExprParserTokens.h              generated
+/cmFortranLexer.cxx                generated
+/cmFortranLexer.h                  generated
+/cmFortranParser.cxx               generated
+/cmFortranParserTokens.h           generated
+/cmListFileLexer.c                 generated

+ 0 - 0
Source/cmCommandArgumentLexer.cxx → Source/LexerParser/cmCommandArgumentLexer.cxx


+ 0 - 0
Source/cmCommandArgumentLexer.h → Source/LexerParser/cmCommandArgumentLexer.h


+ 0 - 0
Source/cmCommandArgumentLexer.in.l → Source/LexerParser/cmCommandArgumentLexer.in.l


+ 0 - 0
Source/cmCommandArgumentParser.cxx → Source/LexerParser/cmCommandArgumentParser.cxx


+ 0 - 1
Source/cmCommandArgumentParser.y → Source/LexerParser/cmCommandArgumentParser.y

@@ -189,4 +189,3 @@ void cmCommandArgument_yyerror(yyscan_t yyscanner, const char* message)
 {
   yyGetParser->Error(message);
 }
-

+ 0 - 0
Source/cmCommandArgumentParserTokens.h → Source/LexerParser/cmCommandArgumentParserTokens.h


+ 0 - 0
Source/cmDependsJavaLexer.cxx → Source/LexerParser/cmDependsJavaLexer.cxx


+ 0 - 0
Source/cmDependsJavaLexer.h → Source/LexerParser/cmDependsJavaLexer.h


+ 0 - 0
Source/cmDependsJavaLexer.in.l → Source/LexerParser/cmDependsJavaLexer.in.l


+ 0 - 0
Source/cmDependsJavaParser.cxx → Source/LexerParser/cmDependsJavaParser.cxx


+ 1 - 2
Source/cmDependsJavaParser.y → Source/LexerParser/cmDependsJavaParser.y

@@ -242,7 +242,7 @@ jp_DECIMALINTEGERLITERAL
   yyGetParser->SetCurrentCombine("");
 }
 |
-jp_HEXINTEGERLITERAL	
+jp_HEXINTEGERLITERAL
 {
   jpElementStart(1);
   jpCheckEmpty(1);
@@ -3212,4 +3212,3 @@ void cmDependsJava_yyerror(yyscan_t yyscanner, const char* message)
 {
   yyGetParser->Error(message);
 }
-

+ 0 - 0
Source/cmDependsJavaParserTokens.h → Source/LexerParser/cmDependsJavaParserTokens.h


+ 0 - 0
Source/cmExprLexer.cxx → Source/LexerParser/cmExprLexer.cxx


+ 0 - 0
Source/cmExprLexer.h → Source/LexerParser/cmExprLexer.h


+ 0 - 0
Source/cmExprLexer.in.l → Source/LexerParser/cmExprLexer.in.l


+ 0 - 1
Source/cmExprParser.cxx → Source/LexerParser/cmExprParser.cxx

@@ -1696,4 +1696,3 @@ void cmExpr_yyerror(yyscan_t yyscanner, const char* message)
 {
   cmExpr_yyget_extra(yyscanner)->Error(message);
 }
-

+ 0 - 1
Source/cmExprParser.y → Source/LexerParser/cmExprParser.y

@@ -162,4 +162,3 @@ void cmExpr_yyerror(yyscan_t yyscanner, const char* message)
 {
   cmExpr_yyget_extra(yyscanner)->Error(message);
 }
-

+ 0 - 0
Source/cmExprParserTokens.h → Source/LexerParser/cmExprParserTokens.h


+ 0 - 0
Source/cmFortranLexer.cxx → Source/LexerParser/cmFortranLexer.cxx


+ 0 - 0
Source/cmFortranLexer.h → Source/LexerParser/cmFortranLexer.h


+ 0 - 0
Source/cmFortranLexer.in.l → Source/LexerParser/cmFortranLexer.in.l


+ 0 - 0
Source/cmFortranParser.cxx → Source/LexerParser/cmFortranParser.cxx


+ 0 - 0
Source/cmFortranParser.y → Source/LexerParser/cmFortranParser.y


+ 0 - 0
Source/cmFortranParserTokens.h → Source/LexerParser/cmFortranParserTokens.h


+ 0 - 0
Source/cmListFileLexer.c → Source/LexerParser/cmListFileLexer.c


+ 0 - 0
Source/cmListFileLexer.in.l → Source/LexerParser/cmListFileLexer.in.l


+ 18 - 7
bootstrap

@@ -240,6 +240,10 @@ CMAKE_UNUSED_SOURCES="\
 "
 
 CMAKE_CXX_SOURCES="\
+  LexerParser/cmCommandArgumentLexer \
+  LexerParser/cmCommandArgumentParser \
+  LexerParser/cmExprLexer \
+  LexerParser/cmExprParser \
   cmAddCustomCommandCommand \
   cmAddCustomTargetCommand \
   cmAddDefinitionsCommand \
@@ -255,8 +259,6 @@ CMAKE_CXX_SOURCES="\
   cmCPackPropertiesGenerator \
   cmCacheManager \
   cmCommand \
-  cmCommandArgumentLexer \
-  cmCommandArgumentParser \
   cmCommandArgumentParserHelper \
   cmCommandArgumentsHelper \
   cmCommands \
@@ -288,8 +290,6 @@ CMAKE_CXX_SOURCES="\
   cmExportSet \
   cmExportSetMap \
   cmExportTryCompileFileGenerator \
-  cmExprLexer \
-  cmExprParser \
   cmExprParserHelper \
   cmExternalMakefileProjectGenerator \
   cmFileCommand \
@@ -417,7 +417,7 @@ if ${cmake_system_mingw}; then
 fi
 
 CMAKE_C_SOURCES="\
-  cmListFileLexer \
+  LexerParser/cmListFileLexer \
   "
 
 if ${cmake_system_mingw}; then
@@ -810,6 +810,11 @@ if [ ! -d "cmsys" ]; then
   cmake_error 4 "Cannot create directory ${cmake_bootstrap_dir}/cmsys"
 fi
 
+[ -d "LexerParser" ] || mkdir "LexerParser"
+if [ ! -d "LexerParser" ]; then
+  cmake_error 5 "Cannot create directory ${cmake_bootstrap_dir}/LexerParser"
+fi
+
 # Delete all the bootstrap files
 rm -f "${cmake_bootstrap_dir}/cmake_bootstrap.log"
 rm -f "${cmake_bootstrap_dir}/cmConfigure.h${_tmp}"
@@ -1431,9 +1436,15 @@ cmake_cxx_flags_SystemTools="
   -DKWSYS_CXX_HAS_UTIMENSAT=${KWSYS_CXX_HAS_UTIMENSAT}
   -DKWSYS_CXX_HAS_UTIMES=${KWSYS_CXX_HAS_UTIMES}
 "
-cmake_c_flags="${cmake_c_flags}-I`cmake_escape \"${cmake_bootstrap_dir}\"` -I`cmake_escape \"${cmake_source_dir}/Source\"` \
+cmake_c_flags="${cmake_c_flags} \
+  -I`cmake_escape \"${cmake_bootstrap_dir}\"` \
+  -I`cmake_escape \"${cmake_source_dir}/Source\"` \
+  -I`cmake_escape \"${cmake_source_dir}/Source/LexerParser\"` \
   -I`cmake_escape \"${cmake_source_dir}/Utilities\"`"
-cmake_cxx_flags="${cmake_cxx_flags} -I`cmake_escape \"${cmake_bootstrap_dir}\"` -I`cmake_escape \"${cmake_source_dir}/Source\"` \
+cmake_cxx_flags="${cmake_cxx_flags} \
+  -I`cmake_escape \"${cmake_bootstrap_dir}\"` \
+  -I`cmake_escape \"${cmake_source_dir}/Source\"` \
+  -I`cmake_escape \"${cmake_source_dir}/Source/LexerParser\"` \
   -I`cmake_escape \"${cmake_source_dir}/Utilities\"`"
 echo "cmake: ${objs}" > "${cmake_bootstrap_dir}/Makefile"
 echo "	${cmake_cxx_compiler} ${cmake_ld_flags} ${cmake_cxx_flags} ${objs} -o cmake" >> "${cmake_bootstrap_dir}/Makefile"