Граф коммитов

256 Коммитов

Автор SHA1 Сообщение Дата
John McCall 7c2342dd4c When pretty-printing tag types, only print the tag if we're in C (and
therefore not creating ElaboratedTypes, which are still pretty-printed
with the written tag).

Most of these testcase changes were done by script, so don't feel too
sorry for my fingers.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98149 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-10 11:27:22 +00:00
Douglas Gregor 3c3aaf9bdf Only parse C++0x attribute specifiers in declarators when in C++0x
mode. This allows us to detect invalid VLAs in Objective-C++
mode. This should be the last of <rdar://problem/7660386>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96679 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-19 16:47:56 +00:00
Douglas Gregor 36262b8155 Implement C++ name lookup for instance variables of Objective-C classes
from an instance method. Previously, we were following the Objective-C
name lookup rules for ivars, which are of course completely different
from and incompatible with the Objective-C++ rules.

For the record, the Objective-C++ rules are the sane ones.

This is another part of <rdar://problem/7660386>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96677 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-19 16:08:35 +00:00
Douglas Gregor c5e77d5a97 Make Sema::ActOnClassMessage robust when name lookup for the receiver
name finds something other than a TypedefDecl or an
ObjCInterfaceDecl. This is a small part of <rdar://problem/7660386>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96676 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-19 15:18:45 +00:00
Fariborz Jahanian 72a8659e9c Patch to allow reinterpret_cast on objective-c pointers.
(partial fix for radar 7591784).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95245 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-03 20:32:31 +00:00
Fariborz Jahanian f7c43fdd28 Also allow cast of block pointer type to
pointer to an any object. Another variation of
radar 7562285.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94052 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-21 00:05:09 +00:00
Fariborz Jahanian b351a7daad In objective-c++ land, a block pointer is another object pointer.
So, casting a generic object pointer ('id' or 'Class') to the
block pointer is allowed. Fixes radar 7562285.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94045 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-20 22:54:38 +00:00
Fariborz Jahanian 83b7b31fff Allow conversion of pointer to an objective-c pointer to
a similar pointer. Fixes radar 7552179.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93803 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-18 22:59:22 +00:00
Douglas Gregor aa03731079 Switch initialization of parameters in a call over to
InitializationSequence (when a FunctionDecl is present). This required
a few small fixes to initialization sequences:

  - Make sure to use the adjusted parameter type for initialization of
  function parameters.
  - Implement transparent union calling semantics in C



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91902 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-22 07:24:36 +00:00
Fariborz Jahanian 51874dd2ed Allow comparison of 'void *' with function pointer
as a g++ extension (fixes radar 7481987).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91827 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-21 18:19:17 +00:00
Eli Friedman cfdc81a834 Initialization improvements: addition of string initialization and a few
small bug fixes in SemaInit, switch over SemaDecl to use it more often, and
change a bunch of diagnostics which are different with the new initialization
code.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91767 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-19 08:11:05 +00:00
Fariborz Jahanian adcfab1ffc Allow pointer convesion of an objective-c pointer to
'void *' to mimic gcc's behavior. (fixes radar 7477351).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91570 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-16 23:13:33 +00:00
Fariborz Jahanian dd69aae285 Diagnose property of reference type as unsupported
instead of crashing for now. 


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91546 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-16 18:03:30 +00:00
Daniel Dunbar a5728872c7 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).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91446 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-15 20:14:24 +00:00
Fariborz Jahanian 854a4eb761 Make tests use the new clang -cc1 flag.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91298 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-14 17:43:07 +00:00
Fariborz Jahanian 3b27f1a80e Patch to allow C-style cast from 'void *' to block pointer type.
(fixes radar 7465023).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91171 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-11 22:40:48 +00:00
Fariborz Jahanian 1f7711d113 Consider conversion of objective-c pointer to 'bool' a
valid standard conversion to match g++'s behaviour.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91157 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-11 21:23:13 +00:00
Chris Lattner 7e1848ddba Give the "cannot pass object of non-POD type 'class C' through variadic constructor; call will abort at runtime" warning a -W flag (non-pod-varargs) and default it being an error by default. There is no good reason to allow users to get bitten by this sort of thing by default.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91094 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-11 01:52:50 +00:00
Fariborz Jahanian 737061fc29 Patch to fix a crash trying to access a category name in
objective-c++ mode and also removed dead-code in this area.
(fixes radar 7456710).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91081 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-11 00:26:36 +00:00
Fariborz Jahanian 505c882768 No need to add -x objecitve-c++
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91060 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-10 20:57:43 +00:00
Fariborz Jahanian 5501636b41 Add support for finding composite type of twp objective-c pointers
in objective-c++ mode.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91059 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-10 20:46:08 +00:00
Fariborz Jahanian 92ef5d7572 More detailed analysis of typecast to an objective-c pointer
in objective-c++ mode without being too lenient.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90895 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-08 23:09:15 +00:00
Fariborz Jahanian 0cedfbdb44 Patch to allow matching 0 with an objective-c pointer type
in objective-c++ mode. Fixes radar 7443165



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90874 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-08 20:04:24 +00:00
Fariborz Jahanian ebea307a76 Patch to allow cstyle cast of objective-c pointers in objective-c++
mode as they are pervasive.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90867 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-08 19:22:33 +00:00
Daniel Dunbar d73902121a Switch XFAIL format to match LLVM.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85880 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-03 07:25:45 +00:00
Chris Lattner 4029ac0270 this test crashes, disable it harder.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77342 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-28 18:22:50 +00:00
Mike Stump d1969d803c Prep for new warning.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76709 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-22 00:43:08 +00:00
Daniel Dunbar 9685aeef5f Remove excessive use of Carbon.h / Cocoa.h in clang tests.
- These kinds of "shotgun" tests are very slow, and do not belong in the
   regression suite. If these kinds of tests are regarded to have value, they
   should be added to the LLVM test-suite.

 - I would actually like to remove all of these tests, but I left Sema/carbon.c
   and SemaObjC/cocoa.m...


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75399 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-11 23:03:07 +00:00
Steve Naroff 14108da7f7 This patch includes a conceptually simple, but very intrusive/pervasive change.
The idea is to segregate Objective-C "object" pointers from general C pointers (utilizing the recently added ObjCObjectPointerType). The fun starts in Sema::GetTypeForDeclarator(), where "SomeInterface *" is now represented by a single AST node (rather than a PointerType whose Pointee is an ObjCInterfaceType). Since a significant amount of code assumed ObjC object pointers where based on C pointers/structs, this patch is very tedious. It should also explain why it is hard to accomplish this in smaller, self-contained patches.

This patch does most of the "heavy lifting" related to moving from PointerType->ObjCObjectPointerType. It doesn't include all potential "cleanups". The good news is additional cleanups can be done later (some are noted in the code). This patch is so large that I didn't want to include any changes that are purely aesthetic.

By making the ObjC types truly built-in, they are much easier to work with (and require fewer "hacks"). For example, there is no need for ASTContext::isObjCIdStructType() or ASTContext::isObjCClassStructType()! We believe this change (and the follow-up cleanups) will pay dividends over time. 

Given the amount of code change, I do expect some fallout from this change (though it does pass all of the clang tests). If you notice any problems, please let us know asap! Thanks.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75314 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-10 23:34:53 +00:00
Daniel Dunbar fcf3de3749 Add an XFAIL test to demonstrate references in Obj-C++, this currently crashes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72923 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-05 06:03:19 +00:00
Argyrios Kyrtzidis 7c94c4bb7b Use "()" instead of "(void)" when pretty-printing a parameter-less function type for C++.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72747 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-03 02:06:50 +00:00
Daniel Dunbar 868bd0aa92 Improve handling of (X86) target features.
- This is a WIP...

 - This adds -march= handling to the driver, and fixes the defaulting
   of -mcpu on Darwin (which was using the wrong test).

Instead of handling -m{sse, ...} in the driver, pass them to clang-cc as
 -target-feature [+-]name

In clang-cc, communicate with the (clang) target to discover the legal
features of a target, and the features which are enabled based on
-mcpu. This is currently hardcoded just enough to not be a feature
regression, we need to get this information from the backend's
TableGen information somehow.

This is used to construct the full list of features which are being
used, which is in turn used to initialize the predefines.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71061 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-06 03:16:41 +00:00
Fariborz Jahanian b33f3ad379 Check for method type conflict between declaration in
class/protocol and implementation which could be
an imm. implementation or down in the inheritance
hierarchy.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70568 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-01 20:07:12 +00:00
Daniel Dunbar 0b5b0da158 Pull clang-cc code for generating PTH files based on the input type.
- <rdar://problem/6741594> [pth] don't abuse -x to drive pth
   generation

 - Simpler, and fixes PR3915.

Cleanup test cases for PTH:
 - Update to use -emit-pth

 - Removed PTH test of carbon.c and cocoa.mm; these didn't actually
   verify anything, and since PTH is token based the extra coverage
   (over cocoa.m) isn't particularly helpful.

 - Split PTH tests in cocoa.m to cocoa-pth.m, solely to increase
   available parallelism when running tests.

Ted, could you update the PTH test cases (include-pth.c and
cocoa-pth.m) to have some sort of positive check that the PTH is
getting used? "# of PTH cache hits" or "tokens read from PTH cache"
statistics would work great. :)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68189 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-01 05:09:09 +00:00
Daniel Dunbar d7d5f0223b Rename clang to clang-cc.
Tests and drivers updated, still need to shuffle dirs.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67602 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-24 02:24:46 +00:00
Douglas Gregor c71e28c6a5 When inside an Objective-C++ method, name lookup should look into the
interface for ivars before assuming that this is an unresolved
function name.

Fixes <rdar://problem/6590445>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64653 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-16 19:28:42 +00:00
Anders Carlsson 672c91db00 id<Foo> is a POD type.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64175 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-09 21:53:01 +00:00
Douglas Gregor 50f4e7031f Add a test case for some Objective-C behavior that will not be supported in Objective-C++
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64019 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-07 17:16:20 +00:00
Douglas Gregor 7dda67d8de Improvements and fixes for name lookup with using directives, from Piotr Rak!
Also, put Objective-C protocols into their own identifier
namespace. Otherwise, we find protocols when we don't want to in C++
(but not in C).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63877 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-05 19:25:20 +00:00
Douglas Gregor fa047648b2 Initial implementation of argument dependent lookup (a.k.a. ADL,
a.k.a. Koenig lookup) in C++. Most of the pieces are in place, but for
two:

  - In an unqualified call g(x), even if the name does not refer to
    anything in the current scope, we can still find functions named
    "g" based on ADL. We don't yet have this ability.
  - ADL will need updating for friend functions and templates.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63692 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-04 00:32:51 +00:00
Anders Carlsson dce5e2cabf Use a single function for doing vararg argument promotion. Also, make sure to do the promotion before checking the type - fixes PR3340.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62323 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-16 16:48:51 +00:00
Anders Carlsson 906fed0fb5 Warn when someone tries to pass a variable with a non-POD type to a varargs function/method/block.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62148 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-13 05:48:52 +00:00
Ted Kremenek be3f7f3fd8 Re-enable PTH testing for Cocoa.h and Carbon.h (and include testing for Objective-C++).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61965 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-09 00:41:48 +00:00
Douglas Gregor ce35607c28 Allow Objective-C entities to be declared within a transparent context
nested in the translation unit. This fixes <rdar://problem/6476070>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61832 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-06 23:51:29 +00:00
Douglas Gregor 2a7e58dc24 Add some block-pointer conversions in C++
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61359 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-23 00:53:59 +00:00
Douglas Gregor 27b09ac9f7 Support conversion from a null pointer constant o any Objective-C object pointer type. Fixes rdar://problem/6463298
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61340 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-22 20:51:52 +00:00
Douglas Gregor a46969d6cf Add a missing @end. Why didn't this get diagnosed?
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61256 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-19 19:16:37 +00:00
Douglas Gregor c788751123 Support more implicit conversions for Objective-C types. Addresses <rdar://problem/6458293>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61255 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-19 19:13:09 +00:00
Douglas Gregor 45920e82bd Allow downcasts of pointers to Objective-C interfaces, with a
warning. This matches GCC's behavior and addresses
<rdar://problem/6458293>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61246 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-19 17:40:08 +00:00
Douglas Gregor dda78893c8 Add some more implicit conversions for Objective-C++
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61229 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-18 23:43:31 +00:00
Douglas Gregor d6fb7ef028 Ultrasimplistic sketch for the parsing of C++ template-ids. This won't
become useful or correct until we (1) parse template arguments
correctly, (2) have some way to turn template-ids into types,
declarators, etc., and (3) have a real representation of templates.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61208 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-18 19:37:40 +00:00
Douglas Gregor 7ca09760ee Add implicit conversions for Objective-C qualified ids, e.g.,
id<P0>

The intended overloading behavior of these entities isn't entirely
clear, and GCC seems to have some strange limitations (e.g., the
inability to overload on id<P0> vs. id<P1>). We'll want to revisit
these semantics and determine just how Objective-C++ overloading
should really work.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60142 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 01:19:21 +00:00
Douglas Gregor cb7de523cc Implement implicit conversions for Objective-C specific types, e.g.,
converting a pointer to one Objective-C interface into a pointer to another
Objective-C interface, and conversions with 'id'. The semantics seems
to match GCC, although they seem somewhat ad hoc.

Fixed a few cases where we assumed the C++ definition of isObjectType,
but were getting the C definition, causing failures in trouble with
conversions to void pointers.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60130 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-26 23:31:11 +00:00
Anders Carlsson 15281450f5 Make it an error if an Objective-C declaration is not in the global scope.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58705 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-04 16:57:32 +00:00
Anders Carlsson 4f3cc81896 Add carbon.cpp and cocoa.mm tests
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55262 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-23 22:21:00 +00:00
Anders Carlsson ef048ef393 Reserved C++ words are valid selectors in Objective-C++
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55253 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-23 21:00:01 +00:00