mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-03 08:30:47 +03:00
32 lines
988 B
D
32 lines
988 B
D
// Tests LDC-specific attributes
|
|
|
|
// RUN: %ldc -O -c -output-ll -of=%t.ll %s && FileCheck %s < %t.ll
|
|
|
|
import ldc.attributes;
|
|
|
|
//---- @(section) -----------------------------------------------------
|
|
|
|
// CHECK-DAG: @{{.*}}mySectionedGlobali{{.*}} section ".mySection"
|
|
@(section(".mySection")) int mySectionedGlobal;
|
|
|
|
// CHECK-DAG: define{{.*}} void @{{.*}}sectionedfoo{{.*}} section "funcSection"
|
|
@(section("funcSection")) void sectionedfoo() {}
|
|
|
|
//---------------------------------------------------------------------
|
|
|
|
//---------------------------------------------------------------------
|
|
//---- @(weak) --------------------------------------------------------
|
|
|
|
// CHECK-DAG: @{{.*}}myWeakGlobali{{\"?}} = weak
|
|
@(ldc.attributes.weak) int myWeakGlobal;
|
|
|
|
// CHECK-DAG: define{{.*}} weak {{.*}}void @{{.*}}weakFunc
|
|
@weak void weakFunc() {}
|
|
|
|
//---------------------------------------------------------------------
|
|
|
|
|
|
// CHECK-LABEL: define{{.*}} i32 @_Dmain
|
|
void main() {
|
|
sectionedfoo();
|
|
}
|