ldc/tests/codegen/attributes.d
Johan Engelen 823a9efe26 Merge branch 'ltsmaster'
Solved merge conflicts in:
	gen/abi.cpp
	gen/toir.cpp
	runtime/druntime
	tests/d2/dmd-testsuite
	tests/lit.site.cfg.in
2016-03-29 11:40:20 +02:00

32 lines
977 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();
}