hans added inline comments.

================
Comment at: test/CodeGenCXX/dllimport.cpp:1010
+int bar() { T<int> t; return t.foo(); }
+// MO1-DAG: @"?x@?{{1|2}}??foo@?$T@H@pr39496@@Q{{[A-Z]*}}HXZ@4HA" = 
available_externally dllimport global i32 0, align 4
+}
----------------
rnk wrote:
> I notice that we don't emit `foo` as an available_externally definition right 
> now. With your change, will we do so? Should we?
Ah, good point. It's actually the static local that was previously preventing 
us from emitting it available_externally.  We normally would, but 
DLLImportFunctionVisitor would discover that the function referenced a 
non-dllimport "global" variable, and determine that it was not safe to emit the 
definition.

But now that the static local inherits the dll attribute, this works out 
automatically.

```
$ bin/clang -cc1 -triple i686-windows-msvc -fms-extensions -emit-llvm 
-std=c++1y -O1 -disable-llvm-passes -o - 
../tools/clang/test/CodeGenCXX/dllimport.cpp -DMSABI -w | grep 
'define.*?foo@?$T@H@pr39496'
define available_externally dllimport x86_thiscallcc i32 
@"?foo@?$T@H@pr39496@@QAEHXZ"(%"struct.pr39496::T"* %this) #0 align 2 {
```

(Same for S<int>::foo() one.)


Repository:
  rC Clang

https://reviews.llvm.org/D53870



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to