Commit Graph

6 Commits

Author SHA1 Message Date
Serge Pavlov 947719bed1 Process attributes 'ifunc' and 'alias' when checking for redefinition
These attributes effectively turn a non-defining declaration into a
definition, so the case when the declaration already has a body must
be diagnosed properly.

Differential Revision: https://reviews.llvm.org/D30032

llvm-svn: 295541
2017-02-18 06:04:15 +00:00
David Majnemer 290d347471 Revert "Sema: err_after_alias is unreachable, remove it"
This reverts commit r226626.  err_after_alias is, in fact, reachable.

llvm-svn: 226633
2015-01-21 01:30:40 +00:00
David Majnemer 1efd55ff21 Sema: err_after_alias is unreachable, remove it
Examples this would have catched are now handled by the attribute
verification code.

llvm-svn: 226626
2015-01-21 00:52:17 +00:00
David Majnemer 6b90356ab4 Add back a check removed in r226436
It shouldn't have been removed, the code which replaced it didn't cover
this case.

llvm-svn: 226442
2015-01-19 10:21:22 +00:00
David Majnemer 2dc8146643 Sema: Variable definitions cannot be __attribute__((alias))
Things that are OK:
  extern int var1 __attribute((alias("v1")));
  static int var2 __attribute((alias("v2")));

Things that are not OK:
  int var3 __attribute((alias("v3")));
  extern int var4 __attribute((alias("v4"))) = 4;

We choose to accpet:
  struct S { static int var5 __attribute((alias("v5"))); };

  This code causes assertion failues in GCC 4.8 and ICC 13.0.1, we have
  no reason to reject it.

This partially fixes PR22217.

llvm-svn: 226436
2015-01-19 09:00:28 +00:00
Rafael Espindola d53ffa0a70 Treat aliases as definitions.
This fixes pr17639.

Before this patch clang would consider

void foo(void) __attribute((alias("__foo")));

a declaration. It now correctly handles it as a definition.

Initial patch by Alp Toker. I added support for variables.

llvm-svn: 193200
2013-10-22 21:39:03 +00:00