Skip to content

Commit d708635

Browse files
committed
[Dependency Scanning] Collect and report each module dependency's Link Libraries
1 parent 083fdaa commit d708635

34 files changed

+640
-291
lines changed

include/swift-c/DependencyScan/DependencyScan.h

+22-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
/// SWIFTSCAN_VERSION_MINOR should increase when there are API additions.
2626
/// SWIFTSCAN_VERSION_MAJOR is intended for "major" source/ABI breaking changes.
2727
#define SWIFTSCAN_VERSION_MAJOR 0
28-
#define SWIFTSCAN_VERSION_MINOR 9
28+
#define SWIFTSCAN_VERSION_MINOR 10
2929

3030
SWIFTSCAN_BEGIN_DECLS
3131

@@ -46,6 +46,9 @@ typedef struct swiftscan_module_details_s *swiftscan_module_details_t;
4646
/// Opaque container to a dependency info of a given module.
4747
typedef struct swiftscan_dependency_info_s *swiftscan_dependency_info_t;
4848

49+
/// Opaque container to a link library info.
50+
typedef struct swiftscan_link_library_info_s *swiftscan_link_library_info_t;
51+
4952
/// Opaque container to an overall result of a dependency scan.
5053
typedef struct swiftscan_dependency_graph_s *swiftscan_dependency_graph_t;
5154

@@ -64,6 +67,12 @@ typedef struct {
6467
size_t count;
6568
} swiftscan_dependency_set_t;
6669

70+
/// Set of linked libraries
71+
typedef struct {
72+
swiftscan_link_library_info_t *link_libraries;
73+
size_t count;
74+
} swiftscan_link_library_set_t;
75+
6776
typedef enum {
6877
SWIFTSCAN_DIAGNOSTIC_SEVERITY_ERROR = 0,
6978
SWIFTSCAN_DIAGNOSTIC_SEVERITY_WARNING = 1,
@@ -127,9 +136,21 @@ swiftscan_module_info_get_source_files(swiftscan_dependency_info_t info);
127136
SWIFTSCAN_PUBLIC swiftscan_string_set_t *
128137
swiftscan_module_info_get_direct_dependencies(swiftscan_dependency_info_t info);
129138

139+
SWIFTSCAN_PUBLIC swiftscan_link_library_set_t *
140+
swiftscan_module_info_get_link_libraries(swiftscan_dependency_info_t info);
141+
130142
SWIFTSCAN_PUBLIC swiftscan_module_details_t
131143
swiftscan_module_info_get_details(swiftscan_dependency_info_t info);
132144

145+
//=== Link Library Info Functions ------------------------------------===//
146+
SWIFTSCAN_PUBLIC swiftscan_string_ref_t
147+
swiftscan_link_library_info_get_link_name(
148+
swiftscan_link_library_info_t info);
149+
SWIFTSCAN_PUBLIC bool swiftscan_link_library_info_get_is_framework(
150+
swiftscan_link_library_info_t info);
151+
SWIFTSCAN_PUBLIC bool swiftscan_link_library_info_get_should_force_load(
152+
swiftscan_link_library_info_t info);
153+
133154
//=== Dependency Module Info Details Functions ----------------------------===//
134155

135156
SWIFTSCAN_PUBLIC swiftscan_dependency_info_kind_t

include/swift/AST/IRGenOptions.h

+3
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,9 @@ class IRGenOptions {
337337
/// Whether we should disable inserting autolink directives altogether.
338338
unsigned DisableAllAutolinking : 1;
339339

340+
/// Whether we should disable inserting __swift_FORCE_LOAD_ symbols.
341+
unsigned DisableForceLoadSymbols : 1;
342+
340343
/// Print the LLVM inline tree at the end of the LLVM pass pipeline.
341344
unsigned PrintInlineTree : 1;
342345

include/swift/AST/Import.h

+3
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
namespace swift {
3737
class ASTContext;
3838
class ModuleDecl;
39+
class ImportDecl;
3940

4041
// MARK: - Fundamental import enums
4142

@@ -102,6 +103,8 @@ using ImportOptions = OptionSet<ImportFlags>;
102103

103104
void simple_display(llvm::raw_ostream &out, ImportOptions options);
104105

106+
ImportOptions getImportOptions(ImportDecl *ID);
107+
105108
// MARK: - Import Paths
106109

107110
namespace detail {

0 commit comments

Comments
 (0)