File tree Expand file tree Collapse file tree 5 files changed +39
-6
lines changed Expand file tree Collapse file tree 5 files changed +39
-6
lines changed Original file line number Diff line number Diff line change @@ -719,7 +719,8 @@ function(_add_swift_library_single target name)
719
719
# On platforms that use ELF binaries we add markers for metadata sections in
720
720
# the shared libraries using these object files. This wouldn't be necessary
721
721
# if the link was done by the swift binary: rdar://problem/19007002
722
- if ("${SWIFT_SDK_${SWIFTLIB_SINGLE_SDK} _OBJECT_FORMAT}" STREQUAL "ELF" )
722
+ if (SWIFTLIB_TARGET_LIBRARY AND
723
+ "${SWIFT_SDK_${SWIFTLIB_SINGLE_SDK} _OBJECT_FORMAT}" STREQUAL "ELF" )
723
724
if ("${libkind} " STREQUAL "SHARED" )
724
725
set (arch_subdir "${SWIFTLIB_DIR} /${SWIFTLIB_SINGLE_SUBDIR} " )
725
726
Original file line number Diff line number Diff line change @@ -32,9 +32,7 @@ add_subdirectory(PrintAsObjC)
32
32
add_subdirectory (RemoteAST )
33
33
add_subdirectory (Sema )
34
34
add_subdirectory (Serialization )
35
- if (CMAKE_SYSTEM_NAME STREQUAL "Darwin" )
36
- add_subdirectory (SwiftDemangle )
37
- endif ()
35
+ add_subdirectory (SwiftDemangle )
38
36
add_subdirectory (SIL )
39
37
add_subdirectory (SILGen )
40
38
add_subdirectory (SILOptimizer )
Original file line number Diff line number Diff line change @@ -2,6 +2,9 @@ add_swift_library(swiftDemangle SHARED
2
2
SwiftDemangle.cpp
3
3
MangleHack.cpp
4
4
LINK_LIBRARIES swiftDemangling )
5
+ if (NOT APPLE )
6
+ target_link_libraries (swiftDemangle PRIVATE bsd )
7
+ endif ()
5
8
6
9
swift_install_in_component (compiler
7
10
TARGETS swiftDemangle
Original file line number Diff line number Diff line change 17
17
//
18
18
// ===----------------------------------------------------------------------===//
19
19
20
- #include " swift/Strings.h"
21
20
#include " swift/SwiftDemangle/MangleHack.h"
21
+ #include " swift/Strings.h"
22
22
#include < cassert>
23
- #include < cstring >
23
+ #include < cstdarg >
24
24
#include < cstdio>
25
+ #include < cstdlib>
26
+ #include < cstring>
27
+
28
+ #if defined(_WIN32)
29
+ static int vasprintf (char **strp, const char *fmt, va_list ap) {
30
+ int len = _vscprintf (fmt, ap);
31
+ if (len < 0 )
32
+ return len;
33
+ char *buffer = static_cast <char *>(malloc (len + 1 ));
34
+ if (buffer == nullptr )
35
+ return -1 ;
36
+ int result = vsprintf (buffer, fmt, ap);
37
+ if (result < 0 ) {
38
+ free (buffer);
39
+ return -1 ;
40
+ }
41
+ *strp = buffer;
42
+ return result;
43
+ }
44
+
45
+ static int asprintf (char **strp, const char *fmt, ...) {
46
+ va_list args;
47
+ va_start (args, fmt);
48
+ int result = vasprintf (strp, fmt, args);
49
+ va_end (args);
50
+ return result;
51
+ }
52
+ #endif
25
53
26
54
const char *
27
55
_swift_mangleSimpleClass (const char *module , const char *class_) {
Original file line number Diff line number Diff line change 17
17
18
18
#include " swift/Demangling/Demangle.h"
19
19
#include " swift/SwiftDemangle/SwiftDemangle.h"
20
+ #if defined(__linux__) || defined(_WIN32)
21
+ #include < bsd/string.h>
22
+ #endif
20
23
21
24
static size_t swift_demangle_getDemangledName_Options (const char *MangledName,
22
25
char *OutputBuffer, size_t Length,
You can’t perform that action at this time.
0 commit comments