Commit Graph

11 Commits

Author SHA1 Message Date
Douglas Gregor 7260905918 Make sure that we diagnose attribute((overloadable)) functions without
prototypes. Fixes PR7738.

llvm-svn: 110443
2010-08-06 13:50:58 +00:00
John McCall 44c064be73 Check compatibility of vector types using their canonicalizations.
Fixes an assertion arising C overload analysis, but really I can't imagine
that this wouldn't cause a thousand other uncaught failures.

Fixes PR6600.

llvm-svn: 98400
2010-03-12 23:14:13 +00:00
John McCall 12f97bc48a Change the printing of OR_Deleted overload results to print all the candidates,
not just the viable ones.  This is reasonable because the most common use of
deleted functions is to exclude some implicit conversion during calls;  users
therefore will want to figure out why some other options were excluded.

Started sorting overload results.  Right now it just sorts by location in the
translation unit (after putting viable functions first), but we can do better than
that.

Changed bool OnlyViable parameter to PrintOverloadCandidates to an enum for better
self-documentation.

llvm-svn: 92990
2010-01-08 04:41:39 +00:00
Daniel Dunbar 8fbe78f6fc Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.
- This is designed to make it obvious that %clang_cc1 is a "test variable"
   which is substituted. It is '%clang_cc1' instead of '%clang -cc1' because it
   can be useful to redefine what gets run as 'clang -cc1' (for example, to set
   a default target).

llvm-svn: 91446
2009-12-15 20:14:24 +00:00
Daniel Dunbar a45cf5b6b0 Rename clang to clang-cc.
Tests and drivers updated, still need to shuffle dirs.

llvm-svn: 67602
2009-03-24 02:24:46 +00:00
Douglas Gregor 171c45ab0c Downgrade complaints about calling unavailable functions to a warning
(as GCC does), except when we've performed overload resolution and
found an unavailable function: in this case, we actually error.

Merge the checking of unavailable functions with the checking for
deprecated functions. This unifies a bit of code, and makes sure that
we're checking for unavailable functions in the right places. Also,
this check can cause an error. We may, eventually, want an option to
make "unavailable" warnings into errors.

Implement much of the logic needed for C++0x deleted functions, which
are effectively the same as "unavailable" functions (but always cause
an error when referenced). However, we don't have the syntax to
specify deleted functions yet :)

llvm-svn: 64955
2009-02-18 21:56:37 +00:00
Douglas Gregor 94349fd8cb Allow "overloadable" functions in C to be declared as variadic without
any named parameters, e.g., this is accepted in C:

  void f(...) __attribute__((overloadable));

although this would be rejected:

  void f(...);

To do this, moved the checking of the "ellipsis without any named
arguments" condition from the parser into Sema (where it belongs anyway).

llvm-svn: 64902
2009-02-18 07:07:28 +00:00
Douglas Gregor b2809a0a1b Don't allow calls to functions marked "unavailable". There's more work
to do in this area, since there are other places that reference
FunctionDecls.

Don't allow "overloadable" functions (in C) to be declared without a
prototype.

llvm-svn: 64897
2009-02-18 06:34:51 +00:00
Douglas Gregor 13c6362a43 Proof that attribute __overloadable__ works as well as overloadable
llvm-svn: 64781
2009-02-17 18:51:14 +00:00
Douglas Gregor 633b73783f Tighten checking of the "overloadable" attribute. If any function by a
given name in a given scope is marked as "overloadable", every
function declaration and definition with that same name and in that
same scope needs to have the "overloadable" attribute. Essentially,
the "overloadable" attribute is not part of attribute merging, so it
must be specified even for redeclarations. This keeps users from
trying to be too sneaky for their own good:

  double sin(double) __attribute__((overloadable)); // too sneaky
  #include <math.h>

Previously, this would have made "sin" overloadable, and therefore
given it a mangled name. Now, we get an error inside math.h when we
see a (re)declaration of "sin" that doesn't have the "overloadable"
attribute.

llvm-svn: 64414
2009-02-13 00:26:38 +00:00
Douglas Gregor 41e3fc1ff5 Add missing test for the "overloadable" attribute
llvm-svn: 64396
2009-02-12 19:25:19 +00:00