File: ExternalGenericMetadataBuilder.h

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (91 lines) | stat: -rw-r--r-- 3,307 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
//===--- ExternalGenericMetadataBuilder.h - Public 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
//
//===----------------------------------------------------------------------===//
///
/// \file
/// This header declares functions in the libswiftReflection library,
/// which provides mechanisms for reflecting heap information in a
/// remote Swift process.
///
//===----------------------------------------------------------------------===//

#ifndef SWIFT_EXTERNAL_GENERIC_METADATA_BUILDER_H
#define SWIFT_EXTERNAL_GENERIC_METADATA_BUILDER_H

#include <stdint.h>

#include "swift/shims/Visibility.h"

#ifdef __cplusplus
extern "C" {
#endif

struct SwiftExternalMetadataBuilder;
struct mach_header;

// Create a builder object with the given platform and architecture name.
SWIFT_ATTRIBUTE_FOR_EXPORTS
struct SwiftExternalMetadataBuilder *
swift_externalMetadataBuilder_create(int platform, const char *arch);

// Destroy a builder object.
SWIFT_ATTRIBUTE_FOR_EXPORTS
void swift_externalMetadataBuilder_destroy(
    struct SwiftExternalMetadataBuilder *);

// Returns an error string if the dylib could not be added
// The builder owns the string, so the caller does not have to free it
// The mach_header* is the raw dylib from disk/memory, before the shared cache
// builder has created its own copy of it
SWIFT_ATTRIBUTE_FOR_EXPORTS
const char *swift_externalMetadataBuilder_addDylib(
    struct SwiftExternalMetadataBuilder *, const char *install_name,
    const struct mach_header *, uint64_t size);

SWIFT_ATTRIBUTE_FOR_EXPORTS
const char *swift_externalMetadataBuilder_readNamesJSON(
    struct SwiftExternalMetadataBuilder *, const char *names_json);

// Set the log level of the library. Accepted values are:
// 0 - Only fatal errors.
// 1 - Warnings.
// 2 - Informational messages.
// 3 - Detailed informational messages.
SWIFT_ATTRIBUTE_FOR_EXPORTS
void swift_externalMetadataBuilder_setLogLevel(
    struct SwiftExternalMetadataBuilder *, int level);

// Returns an error string if the dylib could not be added. The builder owns the
// string, so the caller does not have to free it. The string remains valid
// until at least the next call to the builder.
SWIFT_ATTRIBUTE_FOR_EXPORTS
const char *swift_externalMetadataBuilder_buildMetadata(
    struct SwiftExternalMetadataBuilder *);

// Get the JSON for the built metadata.
SWIFT_ATTRIBUTE_FOR_EXPORTS
const char *swift_externalMetadataBuilder_getMetadataJSON(
    struct SwiftExternalMetadataBuilder *);

// Convenience function that works with the filesystem and handles everything in
// one call.
SWIFT_ATTRIBUTE_FOR_EXPORTS
int swift_type_metadata_extract(const char *inputPath,       // mangled names
                                const char *dylibSearchPath, // images to add
                                const char *arch,
                                const char *outputPath // json output
);

#ifdef __cplusplus
} // extern "C"
#endif

#endif // SWIFT_EXTERNAL_GENERIC_METADATA_BUILDER_H