From ef2272c49e1da9ef22b142ea4a8dca86a9cf80e5 Mon Sep 17 00:00:00 2001 From: Hans Wennborg Date: Wed, 18 Jun 2014 15:55:13 +0000 Subject: Inherit dll attributes to static locals This makes us handle static locals in exported/imported functions correctly. Differential Revision: http://reviews.llvm.org/D4136 llvm-svn: 211173 --- clang/test/CodeGenCXX/dllimport.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'clang/test/CodeGenCXX/dllimport.cpp') diff --git a/clang/test/CodeGenCXX/dllimport.cpp b/clang/test/CodeGenCXX/dllimport.cpp index 78a15b518e8..6d293998851 100644 --- a/clang/test/CodeGenCXX/dllimport.cpp +++ b/clang/test/CodeGenCXX/dllimport.cpp @@ -85,6 +85,15 @@ USEVAR(GlobalRedecl3) namespace ns { __declspec(dllimport) int ExternalGlobal; } USEVAR(ns::ExternalGlobal) +int f(); +// MO1-DAG: @"\01?x@?1??inlineStaticLocalsFunc@@YAHXZ@4HA" = available_externally dllimport global i32 0 +// MO1-DAG: @"\01??_B?1??inlineStaticLocalsFunc@@YAHXZ@51" = available_externally dllimport global i32 0 +inline int __declspec(dllimport) inlineStaticLocalsFunc() { + static int x = f(); + return x++; +}; +USE(inlineStaticLocalsFunc); + //===----------------------------------------------------------------------===// -- cgit v1.2.3