Hi Rafael,<div><br></div><div>This code doesn't appear to be redundant, one of either this or the next commit broke gcc.dg/debug/redecl-1.c in the GCC test suite.</div><div><br></div><div>You can repro with:</div><div>
--</div><div>$ curl -s <a href="http://llvm.org/svn/llvm-project/clang-tests/trunk/gcc-4_2-testsuite/src/gcc.dg/debug/redecl-1.c">http://llvm.org/svn/llvm-project/clang-tests/trunk/gcc-4_2-testsuite/src/gcc.dg/debug/redecl-1.c</a> | daclang -w -fsyntax-only -x c -<br>
</div><div><stdin>:338:9: error: invalid application of 'sizeof' to an incomplete type 'IA'</div><div>      (aka 'int []')</div><div>  sizeof(*c18());</div><div>        ^~~~~~~~</div><div>1 error generated.</div>
<div>--</div><div><br></div><div> - Daniel</div><div><br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Nov 20, 2012 at 6:47 PM, Rafael Espindola <span dir="ltr"><<a href="mailto:rafael.espindola@gmail.com" target="_blank">rafael.espindola@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: rafael<br>
Date: Tue Nov 20 20:47:19 2012<br>
New Revision: 168410<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=168410&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=168410&view=rev</a><br>
Log:<br>
Remove redundant code.<br>
<br>
Modified:<br>
    cfe/trunk/lib/AST/Decl.cpp<br>
<br>
Modified: cfe/trunk/lib/AST/Decl.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=168410&r1=168409&r2=168410&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=168410&r1=168409&r2=168410&view=diff</a><br>

==============================================================================<br>
--- cfe/trunk/lib/AST/Decl.cpp (original)<br>
+++ cfe/trunk/lib/AST/Decl.cpp Tue Nov 20 20:47:19 2012<br>
@@ -355,30 +355,9 @@<br>
     if (Function->getStorageClass() == SC_PrivateExtern)<br>
       LV.mergeVisibility(HiddenVisibility, true);<br>
<br>
-    // C99 6.2.2p5:<br>
-    //   If the declaration of an identifier for a function has no<br>
-    //   storage-class specifier, its linkage is determined exactly<br>
-    //   as if it were declared with the storage-class specifier<br>
-    //   extern.<br>
-    if (!Context.getLangOpts().CPlusPlus &&<br>
-        (Function->getStorageClass() == SC_Extern ||<br>
-         Function->getStorageClass() == SC_PrivateExtern ||<br>
-         Function->getStorageClass() == SC_None)) {<br>
-      // C99 6.2.2p4:<br>
-      //   For an identifier declared with the storage-class specifier<br>
-      //   extern in a scope in which a prior declaration of that<br>
-      //   identifier is visible, if the prior declaration specifies<br>
-      //   internal or external linkage, the linkage of the identifier<br>
-      //   at the later declaration is the same as the linkage<br>
-      //   specified at the prior declaration. If no prior declaration<br>
-      //   is visible, or if the prior declaration specifies no<br>
-      //   linkage, then the identifier has external linkage.<br>
-      if (const FunctionDecl *PrevFunc = Function->getPreviousDecl()) {<br>
-        LinkageInfo PrevLV = getLVForDecl(PrevFunc, OnlyTemplate);<br>
-        if (PrevLV.linkage()) LV.setLinkage(PrevLV.linkage());<br>
-        LV.mergeVisibility(PrevLV);<br>
-      }<br>
-    }<br>
+    // Note that Sema::MergeCompatibleFunctionDecls already takes care of<br>
+    // merging storage classes and visibility attributes, so we don't have to<br>
+    // look at previous decls in here.<br>
<br>
     // In C++, then if the type of the function uses a type with<br>
     // unique-external linkage, it's not legally usable from outside<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div>