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

105 Коммитов

Автор SHA1 Сообщение Дата
Fariborz Jahanian 4b1e275eb7 Don't ICE when messaging on 'super' receiver when class
of category implementation is undeclared. Issue error instead.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61882 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-07 21:01:41 +00:00
Eli Friedman 82b4e768d3 Silence a couple more operator precedence warnings; this shouldn't
change the semantics.  Please correct this if the precedence was 
actually supposed to be something different.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61099 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-16 20:15:50 +00:00
Chris Lattner d162584991 Change a whole lot of diagnostics to take QualType's directly
instead of converting them to strings first.  This also fixes a
bunch of minor inconsistencies in the diagnostics emitted by clang
and adds a bunch of FIXME's to DiagnosticKinds.def.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59948 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-24 06:25:27 +00:00
Chris Lattner d9d22dd9c9 Rename NamedDecl::getName() to getNameAsString(). Replace a bunch of
uses of getName() with uses of getDeclName().  This upgrades a bunch of
diags to take DeclNames instead of std::strings.

This also tweaks a couple of diagnostics to be cleaner and changes
CheckInitializerTypes/PerformInitializationByConstructor to pass
around DeclarationNames instead of std::strings.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59947 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-24 05:29:24 +00:00
Chris Lattner 077bf5e2f4 Rename Selector::getName() to Selector::getAsString(), and add
a new NamedDecl::getAsString() method.

Change uses of Selector::getName() to just pass in a Selector 
where possible (e.g. to diagnostics) instead of going through
an std::string.

This also adds new formatters for objcinstance and objcclass
as described in the dox.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59933 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-24 03:33:13 +00:00
Chris Lattner 08631c5fa0 Convert IdentifierInfo's to be printed the same as DeclarationNames
with implicit quotes around them.  This has a bunch of follow-on 
effects and requires tweaking to a whole lot of code.  This causes
a regression in two tests (xfailed) by causing it to emit things like:

  Line 10: duplicate interface declaration for category 'MyClass1' ('Category1')

instead of:

  Line 10: duplicate interface declaration for category 'MyClass1(Category1)'

I will fix this in a follow-up commit.

As part of this, I had to start switching stuff to use ->getDeclName() instead
of Decl::getName() for consistency.  This is good, but I was planning to do this
as an independent patch.  There will be several follow-on patches
to clean up some of the mess, but this patch is already too big.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59917 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-23 21:45:46 +00:00
Chris Lattner 2c21a07352 merge some simple call diagnostics.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59831 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-21 18:44:24 +00:00
Chris Lattner f3a41af4d5 remove the last old-fashioned Diag method. Transition complete!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59714 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-20 06:38:18 +00:00
Chris Lattner 8469265156 instead of looking up super at startup time,
just check for it when needed.  It doesn't incur real cost
in any hot paths.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59708 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-20 05:35:30 +00:00
Steve Naroff 5cb93b8bf0 Fix <rdar://problem/6150376> [sema] crash on invalid message send.
The core fix in Sema::ActOnClassMessage(). All the other changes have to do with passing down the SourceLocation for the receiver (to properly position the cursor when producing an error diagnostic).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59639 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 15:54:23 +00:00
Chris Lattner 3c73c41cef stop calling II::getName() unnecesarily in sema
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59609 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 08:23:25 +00:00
Chris Lattner fa25bbb351 Switch several more Sema Diag methods over. This simplifies the
__builtin_prefetch code to only emit one diagnostic per builtin_prefetch.
While this has nothing to do with the rest of the patch, the code seemed
like overkill when I was updating it.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59588 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 05:08:23 +00:00
Steve Naroff 87d3ef08d8 Fix <rdar://problem/6333904> [sema] message lookup on super is incorrect
Missing special lookup rule in Sema::ActOnInstanceMessage().


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59467 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-17 22:29:32 +00:00
Douglas Gregor cd9b46e544 Add a new expression class, ObjCSuperExpr, to handle the Objective-C 'super'. Remove ObjCThis from PredefinedExpr
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58698 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-04 14:56:14 +00:00
Steve Naroff 037cda5282 Fix <rdar://problem/6191148> [sema] Objective-C method lookup (at global scope) fails to handle overloaded selectors properly.
Long standing bug in Sema::ActOnInstanceMessage(). We now warn when messaging an "id" with multiple method signatures in scope. The diags are a little verbose, however they can be streamlined if necessary. 


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56843 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-30 14:38:43 +00:00
Steve Naroff 6c4088e5fc Fix <rdar://problem/6251012> clang: Blocks are objects too.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56791 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-29 16:51:41 +00:00
Steve Naroff e84a864a78 Fix <rdar://problem/6252129> implementation of method in category doesn't effectively declare it for methods below.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56771 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-28 14:55:53 +00:00
Daniel Dunbar 91e19b2029 Fix two bugs exposed by array passing assert:
(1) Additional arguments to variadic methods should have default
promotions applied.

(2) Additional arguments to non-variadic methods were allowed.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56084 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-11 00:50:25 +00:00
Daniel Dunbar 6660c8a4cc Bug fix, apply default argument promotion in message sends for which
no method declaration was found.
 - This was allowing arrays to pass "by value" among other things.

Add assert in CodeGen that arguments cannot have array type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56080 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-11 00:04:36 +00:00
Daniel Dunbar 637cebb67c Refactor common Obj-C message send checking code into
CheckMessageArgumentTypes.
 - No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56079 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-11 00:01:56 +00:00
Daniel Dunbar 662e8b5647 Change Parser & Sema to use interned "super" for comparions.
- Added as private members for each because it is not clear where to
   put the common definition. Perhaps the IdentifierInfos all of these
   "pseudo-keywords" should be collected into one place (this would
   KnownFunctionIDs and Objective-C property IDs, for example).

Remove Token::isNamedIdentifier.
 - There isn't a good reason to use strcmp when we have interned
   strings, and there isn't a good reason to encourage clients to do
   so.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54794 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-14 22:04:54 +00:00
Daniel Dunbar 12bc692a78 Minor #include cleaning
- Drop TokenKinds.h from Action.h
 - Move DeclSpec.h from Sema.h into individual Sema .cpp files


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54625 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-11 03:27:53 +00:00
Chris Lattner d9f6910f4e rename PreDefinedExpr -> PredefinedExpr
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54605 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-10 01:53:14 +00:00
Chris Lattner b77792eabf change more instances of QualType::getCanonicalType to call
ASTContext::getCanonicalType instead (PR2189)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54105 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-26 22:17:49 +00:00
Steve Naroff 7c778f1c54 Cleaunup Sema::ActOnClassMessage(). This commit:
(a) removes a bogus warning.
(b) removes an undesirable usage of the ObjCMessageExpr constructor that takes an IdentifierInfo * (which I will abolish).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54042 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-25 19:39:00 +00:00
Steve Naroff fc93d52ada Fix Sema::ActOnClassMessage() to pass through the identifier for "super".
This fixes a critical rewriter bug (<rdar://problem/6096760> clang ObjC rewriter: 'self' not expected value in class method called with 'super').

Also added a couple FIXME's since I'm not happy with my fix to Sema. It would be nicer if the super handling for class/instance messages was the same (based on PreDefinedExpr).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53994 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-24 19:44:33 +00:00
Chris Lattner 780f329cb0 move two more lists of protocols over to use ObjCList<ObjCProtocolDecl>,
simplifying code along the way and fixing a problem and memory leak or two.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53876 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-21 21:32:27 +00:00
Chris Lattner 3db6cae19c introduce a new ObjCList templated class and start moving
various objc lists over to it.  First up, the protocol list 
on ObjCInterfaceDecl.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53856 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-21 18:19:38 +00:00
Chris Lattner 6562fdad21 when in the context of an @implementation, look for private methods in the
@implementation to resolve nullary selector references.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53845 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-21 06:44:27 +00:00
Chris Lattner 1565e0364b don't pass in null as the Name for GenerateClassStructure,
it goes and makes std::strings out of them, which is not 
defined.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53843 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-21 06:31:05 +00:00
Chris Lattner 0b2f7ea279 improve diagnostics about problems with receivers to highlight the receiver.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53842 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-21 06:16:07 +00:00
Chris Lattner 2b1cc8be4d continue cleaning up code, and disable sending a message directly to an
interface.  This fixes a bug where we used to accept:

void test2(NSNumber x) {
	[x METH];
}

which doesn't make sense and GCC rejects.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53841 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-21 06:12:56 +00:00
Chris Lattner fe1a553256 simplify control flow a bit, reducing indentation. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53837 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-21 05:57:44 +00:00
Chris Lattner b24d921132 tighten up some checks, don't allow sending a message to NSString****
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53836 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-21 05:54:02 +00:00
Chris Lattner c188d308eb merge a bunch of code that is now common between qual interfaces and interfaces.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53833 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-21 05:27:51 +00:00
Chris Lattner 9baefc21bf rename getProtocols -> getProtocol, as it only returns a single
protocol.  Simplify some code to use unconditional form of the
protocol access list.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53832 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-21 05:20:01 +00:00
Argyrios Kyrtzidis 53d0ea5f5b Replace CurFunctionDecl and CurMethodDecl with methods getCurFunctionDecl() and getCurMethodDecl() that return the appropriate Decl through CurContext.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52852 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-28 06:07:14 +00:00
Ted Kremenek 4df728e368 ObjCMessageExpr objects that represent messages to class methods now can contain the ObjCInterfaceDecl* of the target class if it was available when the ObjCMessageExpr object was constructed. The original interfaces of the class has been preserved (requiring no functionality changes from clients), but now a "getClasSInfo" method returns both the ObjCInterfaceDecl* and IdentifierInfo* of the target class.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52676 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-24 15:50:53 +00:00
Chris Lattner 13fd7e5111 "this patch adds code generation hooks for Objective-C constant strings. It also modifies Sema so that Objective-C constant strings are treated as untyped objects if the interface for the constant string class can not be found. This is consistent with Apple GCC. I thought it was consistent with GNU GCC, since this was causing failures when trying to compile GNUstep with (GNU) GCC, but it appears that this is not the case when attempting to produce a simple test case to demonstrate it. Possibly there is a way of making the error go away, but I haven't found out what it is yet."
Patch by David Chisnall!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52599 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-21 21:44:18 +00:00
Chris Lattner 0d17f6f7b1 Switch 'super' from being a weird cast thing to being a predefined expr node.
Patch by David Chisnall with objc rewriter and stmtdumper updates from me.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52580 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-21 18:04:54 +00:00
Steve Naroff e2af8b16cb Fix <rdar://problem/5986833> clang on xcode: incompatible type returning 'void', expected 'int'.
- Changed Sema::ObjCActOnStartOfMethodDef() to more accurately type "self" in factory methods.
- Changed Sema::ActOnInstanceMessage() to use the new type to restrict the lookup.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52005 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-05 14:49:39 +00:00
Steve Naroff cb28be6e82 Fix crash identified by <rdar://problem/5986085>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51969 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-04 23:08:38 +00:00
Ted Kremenek fd5b2ce150 Added fixmes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51964 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-04 20:48:08 +00:00
Fariborz Jahanian 26631704d1 Fix a gcc compatibility issue which allows more protocol-qualified id on RHS to be
assigned to less protocol qualified object on LHS.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51956 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-04 19:00:03 +00:00
Steve Naroff 9ad23d6f45 Sema::ActOnClassMessage() needs to look through it's local implementation for private class methods.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51938 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-04 14:43:54 +00:00
Steve Naroff 289d9f243d Tweak Sema::ObjCQualifiedIdTypesAreCompatible() to handle qualified interface types on the RHS.
This eliminates a bogus warning identified in the test below.

This fixes <rdar://problem/5968256> clang on xcode: error: incompatible type initializing 'NSObject<XCSelectionSource> *', expected 'id<NSObject,XCSelectionSource>'


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51832 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-01 02:43:50 +00:00
Steve Naroff 94a82c9302 Fix <rdar://problem/5965704> clang: bad receiver type 'id const'
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51809 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-31 02:19:15 +00:00
Steve Naroff f494b579b2 - Move ObjC Expresssion AST's from Expr.h => ExprObjC.h
- #include ExprObjC.h in many places


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51703 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-29 21:12:08 +00:00
Chris Lattner b1698cf972 Restructure and simplify Sema::ObjCQualifiedIdTypesAreCompatible,
deleting dead code, making other code more obvious, and fixing a
bug.  This fixes these (bogus) warnings in release mode:

SemaExprObjC.cpp:383: warning: 'RHSProtoE' may be used uninitialized in this function
SemaExprObjC.cpp:383: warning: 'RHSProtoI' may be used uninitialized in this function




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49984 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-20 02:09:31 +00:00
Chris Lattner eca7be6b7e move ObjCQualifiedIdTypesAreCompatible out of ASTContext into Sema.
While it is similar to the other compatibility predicates in ASTContext,
it is not used by them and is different.

In addition, greatly simplify ObjCQualifiedIdTypesAreCompatible and
fix some canonical type bugs.  Also, simplify my Type::getAsObjC* methods.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49313 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-07 05:30:13 +00:00
Chris Lattner 987798ad1d properly handle array decay in objc message exprs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49098 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-02 17:17:33 +00:00
Steve Naroff b327ce0295 Two changes to Sema::LookupDecl() interface.
(1) Remove IdLoc (it's never used). 
(2) Add a bool to enable/disable lazy builtin creaation (defaults to true).

This enables us to use LookupDecl() in Sema::isTypeName(), which is also part of this commit.

To make this work, I changed isTypeName() to be a non-const member function. I'm not happy with this, however I fiddled with making LookupDecl() and friends const and it got ugly pretty quickly. We can certainly add it back if/when someone has time to fiddle with it. For now, I thought this simplification was more important than retaining the const-ness. 



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49087 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-02 14:35:35 +00:00
Steve Naroff e8043c3917 Fairly large "cleaup" related to changing ObjCCompatibleAliasDecl superclass (to inherit from NamedDecl, instead of ScopedDecl).
- Added a DenseMap to associate an IdentifierInfo with the ObjCCompatibleAliasDecl.
- Renamed LookupScopedDecl->LookupDecl and changed it's return type to Decl. Also added lookup for ObjCCompatibleAliasDecl's.
- Removed Sema::LookupInterfaceDecl(). Converted clients to used LookupDecl().
- Some minor indentation changes.

Will deal with ObjCInterfaceDecl and getObjCInterfaceDecl() in a separate commit...



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49058 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-01 23:04:06 +00:00
Steve Naroff 95110968dc Make sure Sema::ActOnClassMessage() correctly diagnoses "super".
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48924 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-28 21:37:05 +00:00
Chris Lattner bda0b626e7 Make a major restructuring of the clang tree: introduce a top-level
lib dir and move all the libraries into it.  This follows the main
llvm tree, and allows the libraries to be built in parallel.  The
top level now enforces that all the libs are built before Driver,
but we don't care what order the libs are built in.  This speeds
up parallel builds, particularly incremental ones.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48402 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-15 23:59:48 +00:00