Aaron Ballman | 165435ff | 2019-03-19 14:53:52 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-llvm -fms-extensions -Wno-ignored-attributes -Wno-extern-initializer -o - %s | FileCheck %s -check-prefix CHECK-LNX |
| 2 | // RUN: %clang_cc1 -triple x86_64-pc-windows-msvc -emit-llvm -fms-extensions -o - -DMSVC %s | FileCheck %s -check-prefix CHECK-MSVC |
| 3 | |
| 4 | // Export const variable. |
| 5 | |
| 6 | // CHECK-MSVC: @x = dso_local dllexport constant i32 3, align 4 |
| 7 | // CHECK-LNX: @x = constant i32 3, align 4 |
| 8 | |
| 9 | // CHECK-MSVC: @z = dso_local constant i32 4, align 4 |
| 10 | // CHECK-LNX: @z = constant i32 4, align 4 |
| 11 | |
| 12 | // CHECK-MSVC: @y = common dso_local dllexport global i32 0, align 4 |
| 13 | // CHECK-LNX: @y = common global i32 0, align 4 |
| 14 | |
| 15 | __declspec(dllexport) int const x = 3; |
| 16 | __declspec(dllexport) const int y; |
| 17 | |
| 18 | // expected-warning@+1 {{'extern' variable has an initializer}} |
| 19 | extern int const z = 4; |
| 20 | |
| 21 | int main() { |
| 22 | int a = x + y + z; |
| 23 | return a; |
| 24 | } |