<div dir="ltr"><div>In addition to the Sema tests, this change needs tests in CodeGenObjC to show where the attribute is applied in the IR.</div><div><br></div><div>--- a/lib/CodeGen/CGBlocks.cpp<br></div><div>+++ b/lib/CodeGen/CGBlocks.cpp</div><div>@@ -2334,5 +2334,9 @@ llvm::Constant *CodeGenModule::getNSConcreteStackBlock() {</div><div> Int8PtrTy->getPointerTo(),</div><div> nullptr);</div><div> configureBlocksRuntimeObject(*this, NSConcreteStackBlock);</div><div>+ if (getContext().getLangOpts().MSVCCompat) {</div><div>+ auto *GV = cast<llvm::GlobalValue>(NSConcreteStackBlock->stripPointerCasts());</div><div>+ GV->setDLLStorageClass(llvm::GlobalValue::DLLImportStorageClass);</div><div>+ }</div><div> return NSConcreteStackBlock; </div><div> }</div><div><br></div><div>I have a feeling that you want to configure all of these blocks runtime references to be dllimport, so maybe move this into configureBlocksRuntimeObject and do it before the early return.</div><div><br></div><div>You probably also want to conditionalize these imports on Triple::isOSBinFormatCOFF() instead of MSVCCompat. Any Windows blocks runtime will want to import these.</div><div><br></div><div><div> llvm::Value *CGObjCGNU::EmitNSAutoreleasePoolClassRef(CodeGenFunction &CGF) {</div><div>- return GetClassNamed(CGF, "NSAutoreleasePool", false);</div><div>+ return GetClassNamed(CGF, "NSAutoreleasePool", false, CGF.CGM.getTarget().getTriple().isKnownWindowsMSVCEnvironment());</div><div> }</div></div><div><br></div><div>Again, probably isOSBinFormatCOFF. I suppose you don't want to use dllimport if the obj-c runtime is statically linked, so you might want to wrap this all up in a predicate like CGObjCGNU::isRuntimeDLLImport. Also, wrap to 80cols with clang-format.</div><div><br></div><div><div>+++ b/test/SemaObjC/dllimport.m</div></div><div><br></div><div>This file should have Unix line endings.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Apr 4, 2016 at 12:34 PM, Wes Witt via cfe-commits <span dir="ltr"><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="EN-US" link="#0563C1" vlink="#954F72">
<div>
<p class="MsoNormal">Please accept this diff as a change to support dllimport of objective c interfaces on windows. I’ve included a new test and changes to an existing test as well. All clang tests pass on Linux & Windows. This change is required for Microsoft’s
use of the clang compiler in support of objective c on windows.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Thanks,<u></u><u></u></p>
<p class="MsoNormal">Wes Witt<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>
<br>_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br>
<br></blockquote></div><br></div>