(&self, cv: &'ll Value, align: Align, kind: Option<&str>)
| 349 | |
| 350 | impl<'ll, 'tcx> StaticMethods for CodegenCx<'ll, 'tcx> { |
| 351 | fn static_addr_of(&self, cv: &'ll Value, align: Align, kind: Option<&str>) -> &'ll Value { |
| 352 | if let Some(&gv) = self.const_globals.borrow().get(&cv) { |
| 353 | unsafe { |
| 354 | // Upgrade the alignment in cases where the same constant is used with different |
| 355 | // alignment requirements |
| 356 | let llalign = align.bytes() as u32; |
| 357 | if llalign > llvm::LLVMGetAlignment(gv) { |
| 358 | llvm::LLVMSetAlignment(gv, llalign); |
| 359 | } |
| 360 | } |
| 361 | return gv; |
| 362 | } |
| 363 | let gv = self.static_addr_of_mut(cv, align, kind); |
| 364 | unsafe { |
| 365 | llvm::LLVMSetGlobalConstant(gv, True); |
| 366 | } |
| 367 | self.const_globals.borrow_mut().insert(cv, gv); |
| 368 | gv |
| 369 | } |
| 370 | |
| 371 | fn codegen_static(&self, def_id: DefId, is_mutable: bool) { |
| 372 | unsafe { |
no test coverage detected