Skip to content

Commit 6446f13

Browse files
committed
Add note to Module docs about needing to manually set target triple and data layout.
1 parent 493672e commit 6446f13

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Sources/LLVM/Module.swift

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,19 @@ import cllvm
1111
/// together with the LLVM linker, which merges function (and global variable)
1212
/// definitions, resolves forward declarations, and merges symbol table entries.
1313
///
14+
/// Creating a Module
15+
/// ==================
16+
///
17+
/// A module can be created using `init(name:context:)`.
18+
/// Note that the default target triple is bare metal and there is no default data layout.
19+
/// If you require these to be specified (e.g. to increase the correctness of default alignment values),
20+
/// be sure to set them yourself.
21+
///
22+
/// if let machine = try? TargetMachine() {
23+
/// module.targetTriple = machine.triple
24+
/// module.dataLayout = machine.dataLayout
25+
/// }
26+
///
1427
/// Verifying a Module
1528
/// ==================
1629
///

0 commit comments

Comments
 (0)