summaryrefslogtreecommitdiffstats
path: root/clang/AST
Commit message (Collapse)AuthorAgeFilesLines
...
* Fixed includes of "clang/AST/DeclObjC.h" to work on case-sensitiveTed Kremenek2007-10-172-2/+2
| | | | | | | filesystems (was "#include "clang/AST/DeclObjc.h", which worked fine on a case-insensitive HFS+ volume on the Mac). llvm-svn: 43080
* Implementation of AST for @protocol expression.Fariborz Jahanian2007-10-174-0/+30
| | | | llvm-svn: 43075
* Generate code for static variables that don't have initializers. Also, ↵Anders Carlsson2007-10-171-1/+2
| | | | | | report an error if a static initializer is not constant. llvm-svn: 43058
* Add a new Rewriter::getRangeSize method.Chris Lattner2007-10-161-3/+3
| | | | | | | | Rename SourceRange::Begin()/End() to getBegin()/getEnd() for consistency with other code. Start building the rewriter towards handling @encode. llvm-svn: 43047
* Steve, pointer out that getName() is available for selectors. Made code much ↵Fariborz Jahanian2007-10-162-18/+2
| | | | | | smaller, thanks. llvm-svn: 43042
* Fix problem dumping/printing method names with null selector.Fariborz Jahanian2007-10-162-3/+12
| | | | llvm-svn: 43039
* Patch to implement AST generation for objective-c's @selector expression.Fariborz Jahanian2007-10-164-0/+44
| | | | llvm-svn: 43038
* Change the type of ObjCStringLiteral from "struct __builtin_CFString *" to ↵Steve Naroff2007-10-151-0/+8
| | | | | | | | | | "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-153-173/+164
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-152-0/+17
| | | | llvm-svn: 43006
* Added ASTContext::setObjcIdType/getObjcIdType(), set by Sema.Steve Naroff2007-10-152-0/+20
| | | | | | Also noticed ASTContext::BuiltinVaListType wasn't being initialized to the null type (so I set it). llvm-svn: 42983
* Teach the type checker about "id". This removes the following bogus warning...Steve Naroff2007-10-151-2/+22
| | | | | | | | | [dylan:~/llvm/tools/clang] admin% ../../Debug/bin/clang t.m t.m:29:18: warning: incompatible pointer types assigning 'id' to 'NSString *' resultString = [[NSString alloc] initWithFormat:0 arguments:0]; ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ llvm-svn: 42975
* Add support for Pascal strings.Anders Carlsson2007-10-151-1/+1
| | | | llvm-svn: 42974
* - Teach ObjcInterfaceDecl::lookupInstance/ClassMethod to look through protocols.Steve Naroff2007-10-142-2/+32
| | | | | | | - 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/+28
| | | | | | Changed ObjcInterfaceDecl::ListCategories->CategoryList. llvm-svn: 42968
* Generate code for va_start and va_end.Anders Carlsson2007-10-121-0/+4
| | | | llvm-svn: 42939
* This patch implementa objective-c's @compatibilty-alias declaration.Fariborz Jahanian2007-10-111-0/+8
| | | | llvm-svn: 42883
* Implemented parsing of objctive-c protocol conforming type used in Fariborz Jahanian2007-10-111-4/+8
| | | | | | | an identifier statement. Fixed up pretty priting to print this type correctly. llvm-svn: 42866
* slightly simplify interfaceChris Lattner2007-10-111-3/+2
| | | | llvm-svn: 42858
* Add __builtin_va_start to the list of builtins, make __builtin_va_list ↵Anders Carlsson2007-10-112-0/+11
| | | | | | available to builtin functions. llvm-svn: 42857
* Patch to create protocol conforming class types.Fariborz Jahanian2007-10-112-0/+50
| | | | llvm-svn: 42856
* Fix 80 col violations.Chris Lattner2007-10-101-1/+2
| | | | llvm-svn: 42849
* Make sure methods with no return type default to "id".Steve Naroff2007-10-091-1/+0
| | | | | | | | | | 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
* Rename FileVariable -> FileVar for consistency with its class name, Chris Lattner2007-10-082-12/+12
| | | | | | | | | likewise block and param. Reorder the layout of the Decl kind enum so that the inheritance tree is reflected in the ordering. This allows trivial range comparisons to determine whether something is an instance of some abstract class, making classof faster. llvm-svn: 42772
* remove unneeded #includeChris Lattner2007-10-071-1/+0
| | | | llvm-svn: 42731
* move IdentifierTable.h from liblex to libbasic.Chris Lattner2007-10-078-8/+7
| | | | llvm-svn: 42730
* introduce a new NamedDecl class, switch a couple of things over to using it.Chris Lattner2007-10-061-7/+1
| | | | | | | | | | 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
* More tab removal activity.Fariborz Jahanian2007-10-041-17/+17
| | | | llvm-svn: 42608
* Fixed tabs in couple of sources.Fariborz Jahanian2007-10-041-3/+3
| | | | llvm-svn: 42601
* Unified such names as protocol references, instance methods and class methodsFariborz Jahanian2007-10-021-34/+34
| | | | | | and their accessors in a variety of objective-c classes. llvm-svn: 42555
* - Add ObjcInterfaceDecl::lookupInstanceMethod(), lookupClassMethod().Steve Naroff2007-10-022-4/+43
| | | | | | | | - Add ObjcMessageExpr::getSelector(), getClassName(). - Change Sema::getObjCInterfaceDecl() to simply take an IdentifierInfo (no Scope needed). - Remove FIXME for printing ObjCMessageExpr's. llvm-svn: 42543
* This patch introduces the ObjcCategoryImplDecl class and does the checking ↵Fariborz Jahanian2007-10-021-1/+28
| | | | | | | | related to unimplemented methods in category implementation. llvm-svn: 42531
* Migrated LiveVariables and UninitializedVariables to now use theTed Kremenek2007-10-011-0/+2
| | | | | | tracked BlkExpr information now maintained by the CFG class. llvm-svn: 42498
* CFG objects now internally store a (lazily created) map from block-levelTed Kremenek2007-10-011-1/+49
| | | | | | | | expressions to IDs. This is used by various dataflow analyses, but is also useful for anyone querying a CFG to determine where an expression is evaluated. llvm-svn: 42495
* Move ObjC decls to DeclObjC.h, a new AST header.Steve Naroff2007-10-013-0/+3
| | | | | | Update clients and add to project file. llvm-svn: 42494
* Took care of clatter's suggestions, dated.Fariborz Jahanian2007-10-011-1/+1
| | | | | | | September 30, 2007 12:36:58 AM PDT and September 30, 2007 12:50:05 AM PDT llvm-svn: 42490
* Removed "hasImplicitControlFlow" from class CFG, and moved it to class StmtTed Kremenek2007-10-012-24/+22
| | | | | | | | as a member function. This function is no longer needed within the CFG class, and logically belongs to the Stmt class as a predicate for a Stmt instance. llvm-svn: 42489
* Unused ObjcProtoMethod is removed.Fariborz Jahanian2007-09-301-3/+0
| | | | llvm-svn: 42485
* Yesterday I discovered that 78% of all selectors in "Cocoa.h" take 0/1 argument.Steve Naroff2007-09-281-21/+6
| | | | | | | | | | | | This motivated implementing a devious clattner inspired solution:-) This approach uses a small value "Selector" class to point to an IdentifierInfo for the 0/1 case. For multi-keyword selectors, we instantiate a MultiKeywordSelector object (previously known as SelectorInfo). Now, the incremental cost for selectors is only 24,800 for Cocoa.h! This saves 156,592 bytes, or 86%!! The size reduction is also the result of getting rid of the AST slot, which was not strictly necessary (we will associate a selector with it's method using another table...most likely in Sema). This change was critical to make now, before we have too many clients. I still need to add some comments to the Selector class...will likely add later today/tomorrow. llvm-svn: 42452
* Patch for method implementation. It populates ObjcImplementationDecl object ↵Fariborz Jahanian2007-09-271-0/+19
| | | | | | | | with method implementation declarations . It checks and warns on those methods declared in class interface and not implemented. llvm-svn: 42412
* Fix some use of uninit variables issues, reported by Anton.Chris Lattner2007-09-271-1/+1
| | | | llvm-svn: 42396
* Add SelectorInfo (similar in spirit to IdentifierInfo). The key difference ↵Steve Naroff2007-09-271-37/+37
| | | | | | | | | | | | | | | | | | | | is SelectorInfo is not string-oriented, it is a unique aggregate of IdentifierInfo's (using a folding set). SelectorInfo also has a richer API that simplifies the parser/action interface. 3 noteworthy benefits: #1: It is cleaner. I never "liked" storing keyword selectors (i.e. foo:bar:baz) in the IdentifierTable. #2: It is more space efficient. Since Cocoa keyword selectors can be quite long, this technique is space saving. For Cocoa.h, pulling the keyword selectors out saves ~180k. The cost of the SelectorInfo data is ~100k. Saves ~80k, or 43%. #3: It results in many API simplifications. Here are some highlights: - Removed 3 actions (ActOnKeywordMessage, ActOnUnaryMessage, & one flavor of ObjcBuildMethodDeclaration that was specific to unary messages). - Removed 3 funky structs from DeclSpec.h (ObjcKeywordMessage, ObjcKeywordDecl, and ObjcKeywordInfo). - Removed 2 ivars and 2 constructors from ObjCMessageExpr (fyi, this space savings has not been measured). I am happy with the way it turned out (though it took a bit more hacking than I expected). Given the central role of selectors in ObjC, making sure this is "right" will pay dividends later. Thanks to Chris for talking this through with me and suggesting this approach. llvm-svn: 42395
* objc messages have side effects, return true from hasLocalSideEffect,Chris Lattner2007-09-261-0/+2
| | | | | | | | | | fixing: VoidMethod.m:14:5: warning: expression result unused [Greeter hello]; ^~~~~~~~~~~~~~~ llvm-svn: 42380
* Fixed two bugs in CFG construction:Ted Kremenek2007-09-261-14/+11
| | | | | | | | | | | | | | | | | | BUG 1) CFG failed to build for empty functions, or functions containing only NullStmts or empty compound statements. We now handle such cases, although now we cannot test for CFG construction failure by asserting that the last block constructed is not NULL (since it now may be). BUG 2) CFG construction segfaulted on some cases when walking the AST and not taking into account that some children of a statement may be NULL. llvm-svn: 42370
* This patch inserts ivars declared in @implementation in its object and verifies Fariborz Jahanian2007-09-261-0/+13
| | | | | | | that they conform(in type, name and numbers) to those declared in @interface. Test case highlights kind of checking we do here. llvm-svn: 42360
* Handle (int)1.0e40 as an i-c-e.Chris Lattner2007-09-261-13/+10
| | | | llvm-svn: 42334
* This patch introduces a new class to keep track of class implementation ↵Fariborz Jahanian2007-09-251-0/+8
| | | | | | | | | info. It also adds more semantic checks for class and protocol declarations. Test cases are good indications of kind of checking being done in this patch. llvm-svn: 42311
* use the right rounding mode.Chris Lattner2007-09-251-1/+1
| | | | llvm-svn: 42291
* Use the APFloat routines to evaluate FP immediates as Chris Lattner2007-09-221-10/+25
| | | | | | | | | | | | | | | | | | | | | | | integer constant expressions. The only questionable thing is that we now reject: void foo() { switch (1) { case (int)1.0e10000: ; } } with: t.c:5:13: error: case label does not reduce to an integer constant case (int)1.0e10000: ~~~~~^~~~~~~~~ GCC accepts this, emitting the pedwarn: t.c:5: warning: floating constant exceeds range of 'double' llvm-svn: 42238
* further apfloat'ize the front-end, allowing codegen to pass Chris Lattner2007-09-223-3/+3
| | | | | | APFloat straight through to LLVM now. llvm-svn: 42236
OpenPOWER on IntegriCloud