From f327bf7616d0c9ad196c505a2fca9cb84e874561 Mon Sep 17 00:00:00 2001 From: Rintaro Ishizaki Date: Thu, 16 Nov 2023 13:54:14 -0800 Subject: [PATCH 1/2] [CMake] Correct dependencies HeaderDependencies.cpp and the stdlib filelist didn't have dependencies. That causes issues when the content is changed. --- SwiftCompilerSources/CMakeLists.txt | 1 + stdlib/cmake/modules/SwiftSource.cmake | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/SwiftCompilerSources/CMakeLists.txt b/SwiftCompilerSources/CMakeLists.txt index 04204d62bb6e0..a5dfefa536301 100644 --- a/SwiftCompilerSources/CMakeLists.txt +++ b/SwiftCompilerSources/CMakeLists.txt @@ -250,6 +250,7 @@ else() ") add_custom_command( OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/HeaderDependencies.cpp" + DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/HeaderDependencies.cpp.tmp" COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_CURRENT_BINARY_DIR}/HeaderDependencies.cpp.tmp" "${CMAKE_CURRENT_BINARY_DIR}/HeaderDependencies.cpp" diff --git a/stdlib/cmake/modules/SwiftSource.cmake b/stdlib/cmake/modules/SwiftSource.cmake index 3d9499e551c50..19d8111301f27 100644 --- a/stdlib/cmake/modules/SwiftSource.cmake +++ b/stdlib/cmake/modules/SwiftSource.cmake @@ -978,7 +978,8 @@ function(_compile_swift_files add_custom_command_target(unused_var COMMAND ${CMAKE_COMMAND} -E copy_if_different "${file_path}.tmp" "${file_path}" CUSTOM_TARGET_NAME ${file_path_target} - OUTPUT "${file_path}") + OUTPUT "${file_path}" + DEPENDS "${file_path}.tmp") endif() # If this platform/architecture combo supports backward deployment to old From 986415a4af31b8a539c76fbea7c2134c0a5d0e2a Mon Sep 17 00:00:00 2001 From: Rintaro Ishizaki Date: Thu, 16 Nov 2023 14:01:41 -0800 Subject: [PATCH 2/2] [Parse] Remove RegexParserBridging.h This is not used anymore --- include/module.modulemap | 5 -- include/swift/Parse/RegexParserBridging.h | 64 ----------------------- lib/ASTGen/Sources/ASTGen/Regex.swift | 1 - lib/Parse/Lexer.cpp | 1 - 4 files changed, 71 deletions(-) delete mode 100644 include/swift/Parse/RegexParserBridging.h diff --git a/include/module.modulemap b/include/module.modulemap index f967a0bf15e62..af6d37dd090ba 100644 --- a/include/module.modulemap +++ b/include/module.modulemap @@ -26,8 +26,3 @@ module OptimizerBridging { header "swift/SILOptimizer/OptimizerBridging.h" export * } - -module _RegexParserBridging { - header "swift/Parse/RegexParserBridging.h" - export * -} diff --git a/include/swift/Parse/RegexParserBridging.h b/include/swift/Parse/RegexParserBridging.h deleted file mode 100644 index ae6bccc1af06c..0000000000000 --- a/include/swift/Parse/RegexParserBridging.h +++ /dev/null @@ -1,64 +0,0 @@ -//===-- RegexParserBridging.h --- Regex parser interface -*- C++ -*-===// -// -// This source file is part of the Swift.org open source project -// -// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors -// Licensed under Apache License v2.0 with Runtime Library Exception -// -// See https://swift.org/LICENSE.txt for license information -// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors -// -//===----------------------------------------------------------------------===// - - -#ifndef REGEX_PARSER_BRIDGING -#define REGEX_PARSER_BRIDGING - -#include "swift/AST/ASTBridging.h" -#include "swift/Basic/Nullability.h" -#include - -/// Attempt to lex a regex literal string. Takes the following arguments: -/// -/// - CurPtrPtr: A pointer to the current pointer of lexer, which should be the -/// start of the literal. This will be advanced to the point at -/// which the lexer should resume, or will remain the same if this -/// is not a regex literal. -/// - BufferEnd: A pointer to the end of the buffer, which should not be lexed -/// past. -/// - MustBeRegex: whether an error during lexing should be considered a regex -/// literal, or some thing else. -/// - BridgedNullableDiagnosticEngine: RegexLiteralLexingFn should diagnose the -/// token using this engine. -/// -/// Returns: A bool indicating whether lexing was completely erroneous, and -/// cannot be recovered from, or false if there either was no error, -/// or there was a recoverable error. -typedef bool (*RegexLiteralLexingFn)( - /*CurPtrPtr*/ const char *_Nonnull *_Nonnull, - /*BufferEnd*/ const char *_Nonnull, - /*MustBeRegex*/ bool, BridgedNullableDiagnosticEngine); -void Parser_registerRegexLiteralLexingFn(RegexLiteralLexingFn _Nullable fn); - -/// Parse a regex literal string. Takes the following arguments: -/// -/// - InputPtr: A null-terminated C string of the regex literal. -/// - VersionOut: A buffer accepting a regex literal format version. -/// - CaptureStructureOut: A buffer accepting a byte sequence representing the -/// capture structure of the literal. -/// - CaptureStructureSize: The size of the capture structure buffer. Must be -/// greater than or equal to `strlen(InputPtr) + 3`. -/// - DiagnosticBaseLoc: Start location of the regex literal. -/// - BridgedDiagnosticEngine: RegexLiteralParsingFn should diagnose the -/// parsing errors using this engine. -/// -/// Returns: A bool value indicating if there was an error while parsing. -typedef bool (*RegexLiteralParsingFn)(/*InputPtr*/ const char *_Nonnull, - /*VersionOut*/ unsigned *_Nonnull, - /*CaptureStructureOut*/ void *_Nonnull, - /*CaptureStructureSize*/ unsigned, - /*DiagnosticBaseLoc*/ BridgedSourceLoc, - BridgedDiagnosticEngine); -void Parser_registerRegexLiteralParsingFn(RegexLiteralParsingFn _Nullable fn); - -#endif // REGEX_PARSER_BRIDGING diff --git a/lib/ASTGen/Sources/ASTGen/Regex.swift b/lib/ASTGen/Sources/ASTGen/Regex.swift index 573910ada64ab..747d69ccc0b9f 100644 --- a/lib/ASTGen/Sources/ASTGen/Regex.swift +++ b/lib/ASTGen/Sources/ASTGen/Regex.swift @@ -10,7 +10,6 @@ // //===----------------------------------------------------------------------===// -import _RegexParserBridging import ASTBridging import BasicBridging diff --git a/lib/Parse/Lexer.cpp b/lib/Parse/Lexer.cpp index dabf5a3241fa9..543f20f6d47d9 100644 --- a/lib/Parse/Lexer.cpp +++ b/lib/Parse/Lexer.cpp @@ -21,7 +21,6 @@ #include "swift/Basic/SourceManager.h" #include "swift/Bridging/ASTGen.h" #include "swift/Parse/Confusables.h" -#include "swift/Parse/RegexParserBridging.h" #include "llvm/ADT/SmallString.h" #include "llvm/ADT/StringSwitch.h" #include "llvm/ADT/Twine.h"