<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Nov 29, 2016 at 2:31 PM, Hans Wennborg 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">Author: hans<br>
Date: Tue Nov 29 16:31:00 2016<br>
New Revision: 288207<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=288207&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project?rev=288207&view=rev</a><br>
Log:<br>
Don't try to merge DLL attributes on redeclaration of invalid decl (PR31069)<br>
<br>
Modified:<br>
cfe/trunk/lib/Sema/SemaDecl.<wbr>cpp<br>
cfe/trunk/test/Sema/dllimport.<wbr>c<br>
<br>
Modified: cfe/trunk/lib/Sema/SemaDecl.<wbr>cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=288207&r1=288206&r2=288207&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/lib/Sema/<wbr>SemaDecl.cpp?rev=288207&r1=<wbr>288206&r2=288207&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/lib/Sema/SemaDecl.<wbr>cpp (original)<br>
+++ cfe/trunk/lib/Sema/SemaDecl.<wbr>cpp Tue Nov 29 16:31:00 2016<br>
@@ -5651,6 +5651,9 @@ static void checkDLLAttributeRedeclarati<br>
NamedDecl *NewDecl,<br>
bool IsSpecialization,<br>
bool IsDefinition) {<br>
+ if(OldDecl->isInvalidDecl())<br>
+ return;<br>
+<br></blockquote><div><br></div><div>Formatting looks weird here.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
if (TemplateDecl *OldTD = dyn_cast<TemplateDecl>(<wbr>OldDecl)) {<br>
OldDecl = OldTD->getTemplatedDecl();<br>
if (!IsSpecialization)<br>
<br>
Modified: cfe/trunk/test/Sema/dllimport.<wbr>c<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/dllimport.c?rev=288207&r1=288206&r2=288207&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/test/Sema/<wbr>dllimport.c?rev=288207&r1=<wbr>288206&r2=288207&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/test/Sema/dllimport.<wbr>c (original)<br>
+++ cfe/trunk/test/Sema/dllimport.<wbr>c Tue Nov 29 16:31:00 2016<br>
@@ -210,6 +210,10 @@ __declspec(dllimport) void redecl6();<br>
void redecl7();<br>
__declspec(dllimport) inline void redecl7() {}<br>
<br>
+// PR31069: Don't crash trying to merge attributes for redeclaration of invalid decl.<br>
+void __declspec(dllimport) redecl8(unknowntype X); // expected-error{{unknown type name 'unknowntype'}}<br>
+void redecl8(unknowntype X) { } // expected-error{{unknown type name 'unknowntype'}}<br>
+<br>
// External linkage is required.<br>
__declspec(dllimport) static int staticFunc(); // expected-error{{'staticFunc' must have external linkage when declared 'dllimport'}}<br>
<br>
<br>
<br>
______________________________<wbr>_________________<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/<wbr>mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div></div>