Skip to content

Commit 6c71d80

Browse files
committed
[Dependency Scanning] Build libSwiftScan with Swift Modules required for parsing regex
Otherwise scanning actions which encounter regex literals will fail. Resolves rdar://108321860
1 parent 067e4ec commit 6c71d80

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

tools/libSwiftScan/CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ set(LLVM_EXPORTED_SYMBOL_FILE
66

77
add_swift_host_library(libSwiftScan SHARED
88
libSwiftScan.cpp
9-
c-include-check.c)
9+
c-include-check.c
10+
HAS_SWIFT_MODULES)
1011

1112
if(${SWIFT_HOST_VARIANT_SDK} IN_LIST SWIFT_DARWIN_PLATFORMS)
1213
# Workaround for a linker crash related to autolinking: rdar://77839981
@@ -23,7 +24,7 @@ target_link_libraries(libSwiftScan PRIVATE
2324
swiftDriverTool
2425
swiftStaticMirror
2526
swiftRemoteInspection
26-
swiftCompilerStub)
27+
swiftCompilerModules)
2728

2829
set_target_properties(libSwiftScan
2930
PROPERTIES

tools/libSwiftScan/libSwiftScan.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
//===----------------------------------------------------------------------===//
1616

1717
#include "swift/Basic/LLVMInitialize.h"
18+
#include "swift/Basic/InitializeSwiftModules.h"
1819
#include "swift/DriverTool/DriverTool.h"
1920
#include "swift/DependencyScan/DependencyScanImpl.h"
2021
#include "swift/DependencyScan/DependencyScanningTool.h"
@@ -114,6 +115,9 @@ void swiftscan_scanner_cache_reset(swiftscan_scanner_t scanner) {
114115

115116
swiftscan_scanner_t swiftscan_scanner_create(void) {
116117
INITIALIZE_LLVM();
118+
// We must initialize the swift modules responsible for parsing functionality,
119+
// such as parsing regex.
120+
initializeSwiftParseModules();
117121
return wrap(new DependencyScanningTool());
118122
}
119123

0 commit comments

Comments
 (0)