[cfe-commits] r168411 - /cfe/trunk/lib/AST/Decl.cpp

Eli Friedman eli.friedman at gmail.com
Mon Nov 26 13:36:02 PST 2012


On Tue, Nov 20, 2012 at 6:53 PM, Rafael Espindola
<rafael.espindola at gmail.com> wrote:
> Author: rafael
> Date: Tue Nov 20 20:53:22 2012
> New Revision: 168411
>
> URL: http://llvm.org/viewvc/llvm-project?rev=168411&view=rev
> Log:
> Remove redundant code.
>
> Modified:
>     cfe/trunk/lib/AST/Decl.cpp
>
> Modified: cfe/trunk/lib/AST/Decl.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=168411&r1=168410&r2=168411&view=diff
> ==============================================================================
> --- cfe/trunk/lib/AST/Decl.cpp (original)
> +++ cfe/trunk/lib/AST/Decl.cpp Tue Nov 20 20:53:22 2012
> @@ -777,12 +777,10 @@
>          if (llvm::Optional<Visibility> Vis = Function->getExplicitVisibility())
>            LV.mergeVisibility(*Vis, true);
>        }
> -
> -      if (const FunctionDecl *Prev = Function->getPreviousDecl()) {
> -        LinkageInfo PrevLV = getLVForDecl(Prev, OnlyTemplate);
> -        if (PrevLV.linkage()) LV.setLinkage(PrevLV.linkage());
> -        LV.mergeVisibility(PrevLV);
> -      }
> +
> +      // Note that Sema::MergeCompatibleFunctionDecls already takes care of
> +      // merging storage classes and visibility attributes, so we don't have to
> +      // look at previous decls in here.

This commit breaks the following testcase (derived from the gcc testsuite):

typedef int IA[];
typedef int A10[10];

static A10 *c18 (void);
void h18 (void)
{
  sizeof(*c18());
  {
    extern IA *c18 (void);
  }
  sizeof(*c18());
}

Please take a look.

-Eli



More information about the cfe-commits mailing list