summaryrefslogtreecommitdiffstats
path: root/clang/Sema
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix location processing of @encode: the range should include the @ sign.Chris Lattner2007-10-162-0/+2
| | | | | | @selector probably gets this wrong also. llvm-svn: 43048
* Add a new Rewriter::getRangeSize method.Chris Lattner2007-10-161-1/+1
| | | | | | | | Rename SourceRange::Begin()/End() to getBegin()/getEnd() for consistency with other code. Start building the rewriter towards handling @encode. llvm-svn: 43047
* Patch to diagnose duplicate method implementations.Fariborz Jahanian2007-10-161-29/+27
| | | | llvm-svn: 43046
* Remove ObjcMethodDecl::getNumMethodParams/getMethodParamDecl, they aren't ↵Steve Naroff2007-10-162-5/+5
| | | | | | | | used/needed. Change ObjcMethodDecl::getMethodType to getResultType, to match FunctionDecl. llvm-svn: 43045
* Patch to implement AST generation for objective-c's @selector expression.Fariborz Jahanian2007-10-163-0/+34
| | | | llvm-svn: 43038
* Emit diagnostics for methods not found.Steve Naroff2007-10-161-9/+26
| | | | llvm-svn: 43037
* initialization of references should not do default fn/array promotions.Chris Lattner2007-10-161-2/+6
| | | | | | This fixes a bug Anders noticed. llvm-svn: 43024
* Bad cast...need to use dyn_cast_or_null. Also changed ↵Steve Naroff2007-10-162-4/+4
| | | | | | Sema::InitBuiltinVaListType (which had the same bug). llvm-svn: 43023
* Change the type of ObjCStringLiteral from "struct __builtin_CFString *" to ↵Steve Naroff2007-10-151-3/+11
| | | | | | | | | | "NSConstantString *". This makes the typecheck much happier. Without this change, the type checker would have to special case "struct __builtin_CFString *". This change does assume the interface for NSConstantString is declared in the translation unit. I left ASTContext::getCFConstantStringType() around for now (with a comment that says it is currently unused). llvm-svn: 43021
* Move type compatibility predicates from Type to ASTContext. In addition, the ↵Steve Naroff2007-10-151-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | predicates are now instance methods (they were previously static class methods on Type). This allowed me to fix the following hack from this weekend... // FIXME: Devise a way to do this without using strcmp. // Would like to say..."return getAsStructureType() == IdStructType;", but // we don't have a pointer to ASTContext. bool Type::isObjcIdType() const { if (const RecordType *RT = getAsStructureType()) return !strcmp(RT->getDecl()->getName(), "objc_object"); return false; } ...which is now... bool isObjcIdType(QualType T) const { return T->getAsStructureType() == IdStructType; } Side notes: - I had to remove a convenience function from the TypesCompatibleExpr class. int typesAreCompatible() const {return Type::typesAreCompatible(Type1,Type2);} Which required a couple clients get a little more verbose... - Result = TCE->typesAreCompatible(); + Result = Ctx.typesAreCompatible(TCE->getArgType1(), TCE->getArgType2()); Overall, I think this change also makes sense for a couple reasons... 1) Since ASTContext vends types, it makes sense for the type compatibility API to be there. 2) This allows the type compatibility predeciates to refer to data not strictly present in the AST (which I have found problematic on several occasions). llvm-svn: 43009
* Add code generation and sema checking for __builtin_va_arg.Anders Carlsson2007-10-153-10/+47
| | | | llvm-svn: 43006
* Several name lookup conflict detection fixes involving objective-c names.Fariborz Jahanian2007-10-151-2/+14
| | | | llvm-svn: 43000
* Added ASTContext::setObjcIdType/getObjcIdType(), set by Sema.Steve Naroff2007-10-152-7/+4
| | | | | | Also noticed ASTContext::BuiltinVaListType wasn't being initialized to the null type (so I set it). llvm-svn: 42983
* Add support for Pascal strings.Anders Carlsson2007-10-151-2/+13
| | | | llvm-svn: 42974
* - Teach ObjcInterfaceDecl::lookupInstance/ClassMethod to look through protocols.Steve Naroff2007-10-141-1/+5
| | | | | | | - Start looking up methods in the global method pools (for "id"). - Start integrating interface types into the type system. llvm-svn: 42971
* Add category lookup (removing a couple FIXME's).Steve Naroff2007-10-141-2/+2
| | | | | | Changed ObjcInterfaceDecl::ListCategories->CategoryList. llvm-svn: 42968
* - Added Sema::AddFactoryMethodToGlobalPool and ↵Steve Naroff2007-10-143-6/+86
| | | | | | | | | | | Sema::AddInstanceMethodToGlobalPool and DenseMaps. This will allow us to efficiently lookup a method from a selector given no type information (for the "id" data type). - Fixed some funky "} else {" indentation in Sema::ActOnAddMethodsToObjcDecl(). I'd prefer we stay away from this style...it wastes space and isn't any easier to read (from my perspective, at least:-) - Changed Parser::ParseObjCInterfaceDeclList() to only call Action::ActOnAddMethodsToObjcDecl() when it actually has methods to add (since most interface have methods, this is a very minor cleanup). llvm-svn: 42957
* Generate code for va_start and va_end.Anders Carlsson2007-10-122-5/+7
| | | | llvm-svn: 42939
* Patch to check for duplicate method decls in protocols.Fariborz Jahanian2007-10-121-4/+5
| | | | llvm-svn: 42938
* Check and diagnose that objective-c objects may not be statically allocated.Fariborz Jahanian2007-10-121-0/+13
| | | | llvm-svn: 42936
* Added notion of '*' specified format width/specifiers when checkingTed Kremenek2007-10-121-4/+41
| | | | | | | | | printf format strings. Added type checking to see if the matching width/precision argument was of type 'int'. Thanks to Anders Carlsson for reporting this missing feature. llvm-svn: 42933
* Fixed typo in comment.Fariborz Jahanian2007-10-121-1/+1
| | | | llvm-svn: 42928
* Fixed a @compatible_alias bug. In the process, discovered unnecessary 2ndry ↵Fariborz Jahanian2007-10-122-30/+36
| | | | | | | | lookup ok class names and streamlined this logic to do the lookup once. llvm-svn: 42926
* Replace one FIXME with another. We handle protocols just fine now. The ObjC ↵Steve Naroff2007-10-121-3/+5
| | | | | | decl will only be 0 when we have an error on the ObjC decl. I would prefer we pass in a decl that is marked as invalid. I don't think this is critical to fix now, however I'd like us to be consistent. There are currently many places that don't mark the decl as invalid (which need to be fixed)... llvm-svn: 42923
* Add some more diagnostics for va_start, fix tests so they pass with these ↵Anders Carlsson2007-10-121-0/+31
| | | | | | new diags. llvm-svn: 42917
* Fixed a bug whereby, struct tag name matches a typedef/objc-class nameFariborz Jahanian2007-10-121-6/+11
| | | | | | and hid them. llvm-svn: 42915
* Printf argument checking now supports dynamically-passed precisionTed Kremenek2007-10-121-1/+6
| | | | | | specifiers. llvm-svn: 42886
* This patch implementa objective-c's @compatibilty-alias declaration.Fariborz Jahanian2007-10-112-0/+51
| | | | llvm-svn: 42883
* Add __builtin_va_start to the list of builtins, make __builtin_va_list ↵Anders Carlsson2007-10-111-1/+10
| | | | | | available to builtin functions. llvm-svn: 42857
* Patch to create protocol conforming class types.Fariborz Jahanian2007-10-113-13/+24
| | | | llvm-svn: 42856
* Fix 80 col violations.Chris Lattner2007-10-102-6/+10
| | | | llvm-svn: 42849
* Refinements to Sema::GetObjcIdType()...Steve Naroff2007-10-103-13/+20
| | | | | | | | | - Cache the typedef, not the type (avoids importing AST/Type.h). - Emit an error if "id" cannot be found. - Comment the routine and add a FIXME to reconsider how we emulate GCC's new fangled behavior. This isn't a priority for now, since almost no code depends on having "id" built-in. - Add a test. llvm-svn: 42845
* - Make sure default return/argument types (for methods) default to "id".Steve Naroff2007-10-104-21/+51
| | | | | | | - Cache the "id" type in Sema...initialize ObjcIdType and TUScope (oops). - Fix ActOnInstanceMessage to allow for "id" type receivers...still work to do (next). llvm-svn: 42842
* Emit a warning when the body of an if block is a NullStmt.Anders Carlsson2007-10-101-1/+12
| | | | llvm-svn: 42840
* Remove Scope argument from ObjC actions that either don't need it or can now ↵Steve Naroff2007-10-102-28/+24
| | | | | | | | use TUScope. Also improve a recently added comment. llvm-svn: 42826
* Make a significant change to invert the control flow handlingChris Lattner2007-10-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | predefined macros. Previously, these were handled by the driver, now they are handled by the preprocessor. Some fallout of this: 1. Instead of preprocessing two buffers (the predefines, then the main source file) we now start preprocessing the main source file and inject the predefines as a "psuedo #include" from the main source file. 2. #1 allows us to nuke the Lexer::IsMainFile flag and simplify Preprocessor::isInPrimaryFile. 3. The driver doesn't have to know about standard #defines, the preprocessor knows, which is nice for people wanting to define their own drivers. 4. This allows us to put normal tokens in the predefine buffer, for example a definition for __builtin_va_list that is target-specific, and a typedef for id in objc. llvm-svn: 42818
* Make sure methods with no return type default to "id".Steve Naroff2007-10-093-3/+24
| | | | | | | | | | This fixes a crasher in Sema::MatchTwoMethodDeclarations(), identified by selector-overload.m (just added). Added Action::ActOnTranslationUnitScope() and renamed Action::PopScope to ActOnPopScope. Added a Translation Unit Scope instance variable to Sema (will be very useful to ObjC-related actions, since ObjC declarations are always file-scoped). llvm-svn: 42817
* Minor code clean up to make it more readable.Fariborz Jahanian2007-10-091-17/+14
| | | | llvm-svn: 42803
* Update DeclKind enums to reflect ObjcProtocolDecl's inheritance change.Chris Lattner2007-10-091-1/+1
| | | | llvm-svn: 42802
* Remove addition of protocol names to declaration scopes, use a separateFariborz Jahanian2007-10-092-47/+16
| | | | | | | DenseMap to keep track of such declarations and derive ObjcProtocolDecl directyly from NamedScope. llvm-svn: 42801
* rename some "Parse" actions to "ActOn". Move code around inChris Lattner2007-10-092-4/+4
| | | | | | | | ParseFunctionDefinition so that ActOnFunctionDefBody is always called if ActOnStartOfFunctionDef is called. This fixes a crash reported by Nuno Lopes. llvm-svn: 42793
* Prevent memory leak by not creating a category object when there is aFariborz Jahanian2007-10-091-9/+7
| | | | | | fatal error of category's undefined interface. llvm-svn: 42790
* Convert Selector Maps/Sets to use stronger typing (now that we have ↵Steve Naroff2007-10-082-18/+15
| | | | | | DenseMapInfo in IdentifierTable.h). llvm-svn: 42767
* Return NULL on invalid protocol.Fariborz Jahanian2007-10-081-3/+9
| | | | llvm-svn: 42754
* move IdentifierTable.h from liblex to libbasic.Chris Lattner2007-10-073-3/+0
| | | | llvm-svn: 42730
* The identifier shouldn't be added to the scope, the decl should.Chris Lattner2007-10-071-8/+11
| | | | | | This fixes strange assertions that just started triggering. llvm-svn: 42721
* simplify some Selector interfaces.Chris Lattner2007-10-071-16/+8
| | | | llvm-svn: 42715
* move ImplementationClassInfo out of ASTContext into Sema.Chris Lattner2007-10-072-11/+7
| | | | llvm-svn: 42714
* switch ObjcCategoryImplDecl over to being a NamedDecl, remove dead ctor ↵Chris Lattner2007-10-061-3/+2
| | | | | | argument. llvm-svn: 42711
* introduce a new NamedDecl class, switch a couple of things over to using it.Chris Lattner2007-10-061-55/+40
| | | | | | | | | | NamedDecl is a Decl that has an IdentifierInfo (for example, ScopedDecl), but not ObjcMethodDecl. Simplify some code in ActOnAddMethodsToObjcDecl, by doing the cast from DeclTy to Decl at the start of the method. llvm-svn: 42710
OpenPOWER on IntegriCloud