[PATCH] D32332: Add support for transparent overloadable functions in clang

George Burgess IV via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 24 21:07:32 PDT 2017


george.burgess.iv updated this revision to Diff 100201.
george.burgess.iv added a comment.
Herald added a subscriber: jfb.

Fix the aforementioned issue; PTAL.

Note that this fix is slightly backwards incompatible. It disallows code like:

  void foo(int);
  void foo(int) __attribute__((overloadable)); // first decl lacked overloadable, so this one must lack it, as well.

I chose to do it this way because r64414 wanted to make us reject code like:

  double sin(double) __attribute__((overloadable));
  #include <math.h> // error: sin redecl without overloadable

...but it was trivial to get around that by moving the overloadable `sin` decl below the include. So, I feel like us accepting the first code snippet is a small bug.

I tested this change on ChromeOS, which uses `overloadable` in some parts of its C standard library. This backwards incompatibility caused no build breakages on that platform.

If we'd rather stay as backwards-compatible as possible, I have no issues with tweaking this to allow the first example.


https://reviews.llvm.org/D32332

Files:
  include/clang/Basic/AttrDocs.td
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Sema/Sema.h
  lib/Sema/SemaDecl.cpp
  test/CodeGen/mangle-ms.c
  test/CodeGen/mangle.c
  test/CodeGenCXX/mangle-ms.cpp
  test/PCH/attrs.c
  test/Sema/overloadable.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32332.100201.patch
Type: text/x-patch
Size: 28026 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170525/c4277ba8/attachment-0001.bin>


More information about the cfe-commits mailing list