File tree Expand file tree Collapse file tree 6 files changed +63
-10
lines changed Expand file tree Collapse file tree 6 files changed +63
-10
lines changed Original file line number Diff line number Diff line change 1046910469 STRIP_INSTALLED_PRODUCT = NO;
1047010470 STRIP_STYLE = debugging;
1047110471 SWIFT_FORCE_DYNAMIC_LINK_STDLIB = "";
10472- USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/include $(SRCROOT)/source $(LLVM_SOURCE_DIR)/include $(LLVM_SOURCE_DIR)/tools/clang/include $(LLVM_BUILD_DIR)/$(LLVM_BUILD_DIR_ARCH)/include $(LLVM_BUILD_DIR)/$(LLVM_BUILD_DIR_ARCH)/tools/clang/include $(LLVM_SOURCE_DIR)/tools/swift/include $(LLVM_BUILD_DIR)/$(LLVM_BUILD_DIR_ARCH)/tools/swift/include $(LLVM_SOURCE_DIR)/tools/swift/lib $(LLVM_BUILD_DIR)/$(SWIFT_BUILD_DIR_ARCH)/include $(LLVM_BUILD_DIR)/$(LLVM_BUILD_DIR_ARCH)/lib/Target/ARM $(CONFIGURATION_BUILD_DIR)";
10472+ USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/include $(SRCROOT)/source $(LLVM_SOURCE_DIR)/include $(LLVM_SOURCE_DIR)/tools/clang/include $(LLVM_BUILD_DIR)/$(LLVM_BUILD_DIR_ARCH)/include $(LLVM_BUILD_DIR)/$(LLVM_BUILD_DIR_ARCH)/tools/clang/include $(LLVM_SOURCE_DIR)/tools/swift/include $(LLVM_BUILD_DIR)/$(LLVM_BUILD_DIR_ARCH)/tools/swift/include $(LLVM_SOURCE_DIR)/tools/swift/lib $(LLVM_BUILD_DIR)/$(SWIFT_BUILD_DIR_ARCH)/include $(LLVM_BUILD_DIR)/$(LLVM_BUILD_DIR_ARCH)/lib/Target/ARM $(CONFIGURATION_BUILD_DIR) $(SRCROOT)/tools/repl/swift/REPLTime ";
1047310473 WARNING_CFLAGS = (
1047410474 "-Wreorder",
1047510475 "-Wno-newline-eof",
Original file line number Diff line number Diff line change @@ -28,6 +28,16 @@ def repl_executable():
2828def repl_source_file ():
2929 return sys .argv [2 ]
3030
31+
32+ def REPLTime_dir ():
33+ source_file = repl_source_file ()
34+ source_dir = os .path .dirname (source_file )
35+ return os .path .join (source_dir , "REPLTime" )
36+
37+
38+ def search_args_for_repl ():
39+ return ["-I" + REPLTime_dir ()]
40+
3141# Xcode interface
3242
3343
@@ -106,10 +116,9 @@ def module_cache_args_for_repl():
106116
107117def swiftc_args_for_repl ():
108118 return [swiftc_path (),
109- "-DXCODE_BUILD_ME" ] + target_arg_for_repl () + ["-g" ,
110- "-o" ,
119+ "-DXCODE_BUILD_ME" ] + target_arg_for_repl () + ["-o" ,
111120 repl_executable (),
112- repl_source_file ()] + module_cache_args_for_repl () + linker_args_for_repl ()
121+ repl_source_file ()] + module_cache_args_for_repl () + search_args_for_repl () + linker_args_for_repl ()
113122
114123
115124def strip_args_for_repl ():
Original file line number Diff line number Diff line change @@ -20,7 +20,8 @@ endif()
2020
2121set (swift_compile_cmd "${LLDB_SWIFTC} "
2222 -resource -dir "${LLDB_PATH_TO_SWIFT_BUILD} /lib/swift"
23- -module-cache -path "${module_cache_dir} " )
23+ -module-cache -path "${module_cache_dir} "
24+ -I"${CMAKE_CURRENT_SOURCE_DIR} /REPLTime" )
2425
2526if (CMAKE_CROSSCOMPILING )
2627 set (swift_compile_cmd ${swift_compile_cmd} -target "${LLVM_HOST_TRIPLE} " -sdk "${CMAKE_SYSROOT} " )
Original file line number Diff line number Diff line change 1+ // REPLTime.h
2+ //
3+ // This source file is part of the Swift.org open source project
4+ //
5+ // Copyright (c) 2017 Apple Inc. and the Swift project authors
6+ // Licensed under Apache License v2.0 with Runtime Library Exception
7+ //
8+ // See https://swift.org/LICENSE.txt for license information
9+ // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10+ //
11+ // -----------------------------------------------------------------------------
12+
13+ #ifndef REPL_TIME_H
14+ #define REPL_TIME_H
15+
16+ typedef unsigned long long uint64_t ;
17+ typedef unsigned int uint32_t ;
18+ typedef int kern_return_t ;
19+
20+ struct mach_timebase_info {
21+ uint32_t numer ;
22+ uint32_t denom ;
23+ };
24+
25+ typedef struct mach_timebase_info * mach_timebase_info_t ;
26+
27+ extern kern_return_t mach_timebase_info (mach_timebase_info_t info );
28+ extern uint64_t mach_absolute_time ();
29+
30+ kern_return_t __attribute__ ((always_inline )) REPL_mach_timebase_info (mach_timebase_info_t info ) {
31+ return mach_timebase_info (info );
32+ }
33+
34+ uint64_t __attribute__ ((always_inline )) REPL_mach_absolute_time () {
35+ return mach_absolute_time ();
36+ }
37+
38+ #endif //REPL_TIME_H
Original file line number Diff line number Diff line change 1+ module REPLTime [extern_c] {
2+ header "REPLTime.h"
3+ export *
4+ }
Original file line number Diff line number Diff line change 1414// lands in an external Xcode build.
1515#if XCODE_BUILD_ME || !_runtime(_ObjC)
1616#if _runtime(_ObjC)
17- import Darwin
17+ // LLDB may not depend on overlays, so do not import any modules that LLDB doesn't build.
18+ import REPLTime
1819#endif
1920
2021func repl_main( ) -> Int
@@ -38,13 +39,13 @@ func repl_main() -> Int
3839// we want this program to exit without consuming 100% CPU, so we detect any loops
3940// that take less than 100us and if we get three of them in a row, we exit.
4041
41- var timebase_info = mach_timebase_info ( numer: 0 , denom: 0 )
42- Darwin . mach_timebase_info ( & timebase_info)
42+ var timebase_info = REPLTime . mach_timebase_info ( numer: 0 , denom: 0 )
43+ REPLTime . REPL_mach_timebase_info ( & timebase_info)
4344var subsequent_short = 0
4445while subsequent_short < 3 {
45- var start = Darwin . mach_absolute_time ( )
46+ var start = REPLTime . REPL_mach_absolute_time ( )
4647 repl_main ( )
47- var end = Darwin . mach_absolute_time ( )
48+ var end = REPLTime . REPL_mach_absolute_time ( )
4849 var elapsedTicks = end - start
4950 var elapsedNano = ( elapsedTicks * UInt64( timebase_info. numer) ) / UInt64( timebase_info. denom)
5051 if elapsedNano < 100000 {
You can’t perform that action at this time.
0 commit comments