Skip to content

Commit 92bf0d3

Browse files
committed
add objc_abi_version docs and move assert
1 parent 6cc65d1 commit 92bf0d3

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

compiler/rustc_codegen_llvm/src/context.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -688,14 +688,17 @@ impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> {
688688
llvm::set_section(g, c"llvm.metadata");
689689
}
690690

691+
/// The Objective-C ABI that is used.
692+
///
693+
/// This corresponds to the `-fobjc-abi-version=` flag in Clang / GCC.
691694
pub(crate) fn objc_abi_version(&self) -> u32 {
695+
assert!(self.tcx.sess.target.is_like_darwin);
692696
if self.tcx.sess.target.arch == "x86" && self.tcx.sess.target.os == "macos" {
693697
// 32-bit x86 macOS uses ABI version 1 (a.k.a. the "fragile ABI").
694698
1
695699
} else {
696700
// All other Darwin-like targets we support use ABI version 2
697701
// (a.k.a the "non-fragile ABI").
698-
assert!(self.tcx.sess.target.is_like_darwin);
699702
2
700703
}
701704
}

0 commit comments

Comments
 (0)