aboutsummaryrefslogtreecommitdiff
path: root/Sema/SemaDecl.cpp
AgeCommit message (Collapse)Author
2007-11-29Update the initializer's type, in addition to the decl, if we've changed the ↵Christopher Lamb
type of the decl based on it. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44440 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-28Several fixes/simplifications surrounding how we stream top-level decl AST's.Steve Naroff
The following code... typedef struct cssm_data {} CSSM_DATA, *CSSM_DATA_PTR; struct Y { int A; }; struct X { int A; } D; struct X E, F; ...now produces the following output... > ../../Debug/bin/clang xx.c -ast-print Read top-level tag decl: 'cssm_data' typedef struct cssm_data CSSM_DATA; typedef struct cssm_data *CSSM_DATA_PTR; Read top-level tag decl: 'Y' Read top-level tag decl: 'X' Read top-level variable decl: 'D' Read top-level variable decl: 'E' Read top-level variable decl: 'F' ...which is much more accurate than the previous -ast-print output... typedef struct cssm_data CSSM_DATA; typedef struct cssm_data CSSM_DATA; Read top-level variable decl: 'D' Read top-level variable decl: 'E' Read top-level variable decl: 'E' git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44421 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-28Fix a bug checking for 'int foo(void)' that didn't look through typedefs of ↵Chris Lattner
void. Bug pointed out by Michael Zolda, thanks! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44408 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-27Set loc earlier in CheckSingleInitializer to avoid emitting a Chris Lattner
diagnostic without a location. This produces: simpleTest.c:2:18: error: initializer element is not constant int *myPointer = &(myArray[2]); ^~~~~~~~~~~~~ instead of: error: initializer element is not constant git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44375 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-27Move the null pointer constant check from ↵Steve Naroff
Sema::CheckSingleInitializer/ActOnCallExpr/CheckMessageArgumentTypes/ActOnReturnStmt to Sema::CheckSingleAssignmentConstraints. This makes sure all null pointer assignments are considered compatible. Thanks to Seo Sanghyeon for the bug, follow-through, and patch! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44366 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-27handle __vector_size__ like vector_sizeChris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44358 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-20Improve function decl merging, patch by Oliver Hunt!Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44253 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-17Now that we are passing back "free standing decls", make sure -ast-dump ↵Steve Naroff
works like -ast-print. Also added a cast to be safe... git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44209 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-17Make sure Sema::ParsedFreeStandingDeclSpec() returns a decl representing the ↵Steve Naroff
type. Adding basic printing to StmtPrinter::PrintRawDecl(). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44208 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-15Implement support for variadic methods (work in progress).Steve Naroff
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44171 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-14Allow properties within a protocol. The case below was asserting...now it ↵Steve Naroff
works fine. @protocol CAMediaTiming @property int beginTime; @end Comments in the code tell the rest of the story... git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44117 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-14implement test/Sema/typedef-prototype.c, allowing codeChris Lattner
to declare a function with a typedef: typedef int unary_int_func(int arg); unary_int_func add_one; This patch contributed by Seo Sanghyeon! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44100 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-13Give AST-walk passes a way to access DeclSpec attributes on functions andNate Begeman
variables. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44073 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-13Rename Sema method to follow class naming conventionNate Begeman
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44069 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-13Patch to set context (interface, category, etc.) in which method is declared.Fariborz Jahanian
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44038 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-12Add category method definitions incrementally, removing a FIXME (like we do ↵Steve Naroff
for class implementations). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44027 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-12Fix regression to Sema::ObjcActOnStartOfMethodDef()...need to initialize ↵Steve Naroff
InvalidType field to false. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44023 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-12- Minor cleanup to yesterday's changes to Sema::ObjcActOnStartOfMethodDef();Steve Naroff
- Add Sema::CurMethodDecl, in preparation for adding ObjcIvarRefExpr. - Add ObjcInterfaceDecl::lookupInstanceVariable(), in prep for adding ivars. - A couple renames in ObjcInterfaceDecl, while I was in the vicinity:-) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44015 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-12Remove Action::ObjcActOnMethodDefinition(). Rationale:Steve Naroff
- It is not an "action" - it is never called by the parser. - It was only used by one method, Sema::ObjcActOnStartOfMethodDef(). As a result, the logic it embodied is now directly implemented in Sema::ObjcActOnStartOfMethodDef(). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44008 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-12Make sure @property is allowed within a category.Steve Naroff
Bug submitted by Keith Bauer. CookieJar:Desktop keith$ cat test.m #import <WebKit/WebKit.h> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44007 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-12Remove Sema::ObjcBuildMethodParameter().Steve Naroff
Modify Sema::ParseParamDeclarator() to work for both ActOnStartOfFunctionDef() and ObjcActOnStartOfMethodDef(). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44006 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-11Replace 2 method definition actions (ActOnFunctionDefBody, ↵Steve Naroff
ActOnMethodDefBody) with 1 method definition action (ActOnFinishFunctionBody). I can't think of any reason that we would need two action hooks. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44000 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-11This is the last 5% of the solution to teaching Sema::ActOnInstanceMessage() ↵Steve Naroff
about private methods (r43989). While the diff is large, the idea is very simple. When we parse method definitions (in an @implementation), we need to add them incrementally (rather than wait until the @end). Other details... - Renamed Sema::ActOnAddMethodsToObjcDecl() to Sema::ActOnAtEnd(). The methods are now optional arguments. - Removed Parser::AllImplMethods (a nice cleanup). - Added location info to ObjcImplementationDecl (since we will need it very soon:-) - Modified message.m test to no longer allow the bogus diagnostic. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43995 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-11Teach Sema::ActOnInstanceMessage() about private methods. That is, methods ↵Steve Naroff
declared in an implementation (but not listed in the interface). This commit is only 95% of the bug fix. The last piece to this puzzle is to add the method decls to the implementation incrementally (as we encounter them). At the moment, the methods aren't added until we see an @end (which is too late). I will complete this later... git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43989 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-10Fixed a bug which exposed the internally built type to user code.Fariborz Jahanian
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43987 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-10Minor code clean up in method def area.Fariborz Jahanian
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43980 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-10Represent method definitions as separate AST nodes. Pretty print will come next.Fariborz Jahanian
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43979 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-09Some code clean up in the form of name changes for functions whichFariborz Jahanian
process method definitions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43967 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-09Added class context to method declarations. Provide "interface *" typeFariborz Jahanian
to 'self' method of instance methods. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43957 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-09Insert invisble arguments to method definition header.Fariborz Jahanian
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43948 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-08First patch toward rewriting of method definitions. This is work in progress.Fariborz Jahanian
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43915 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-06Patch for objc2's property ASTs, as well as pretty-priting the ASTs.Fariborz Jahanian
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43778 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-06improve decl merging logic to be more correct withChris Lattner
functions. Patch contributed by Nuno Lopes, thanks! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43757 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-06Add better validation for array types when merging decls. PatchChris Lattner
contributed by Oliver Hunt, thanks! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43750 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-01Remaining work to collect objective-c's type qualifiers and use them to encodeFariborz Jahanian
method types. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43617 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-01Propagate bitfield info.Devang Patel
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43613 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-311) More additions for objective-c's qualifier type.Fariborz Jahanian
2) Fixed a test failure (which should have failed all along!). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43589 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-31Fixed problem with rewriting stand-alone @implementation (with no matching ↵Fariborz Jahanian
@interface). A new test case added. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43568 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-31Implement a more sensible strategy for ObjC built-in types (addressing a ↵Steve Naroff
long standing FIXME in Sema::GetObjcIdType()). This removes several gross hacks to work around the previous "lazy" behavior. Two notes: - MinimalActions still needs to be taught about the built-in types (This breaks one of the -noop test cases). I started this, then added a FIXME. - I didn't convert Sema::GetObjcProtoType() yet. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43567 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-31After Anders check-in, we can now encode 'Class' type.Fariborz Jahanian
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43556 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-31Added new type and bitfield fields in some decl types in preparation for ↵Fariborz Jahanian
objective-c's type qualifiers. Added initialization of Class/SEMA types. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43534 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-30minor tweaksChris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43515 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-30Revisited my last patch to be able to do encoding of ivar types with 'id'.Fariborz Jahanian
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43507 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-30Added type encoding for 'id' type.Fariborz Jahanian
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43504 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-30- Add location info to category/protocol AST'sSteve Naroff
- Rewrite categories. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43501 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-30Remove a couple FIXME's for rewriting ObjC interfaces (which are now being ↵Steve Naroff
rewritten properly). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43494 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-30More support for rewriting ObjC intefaces. Still some edge cases to handle...Steve Naroff
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43493 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-29This commit contains lot's of small tweaks to how we pass around and store ↵Steve Naroff
SourceLocation's for interfaces/protocols/categories/implementations. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43475 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-26Start rewriting ObjC interfaces. As a start, we comment out all the methods. ↵Steve Naroff
This involved refining how the parser/AST passes/manages SourceLocations for ObjcMethodDecl's. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43404 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-26This patch allows synthesis generation of ivar offset for legacy objective-c ↵Fariborz Jahanian
@implementation decl without an @interface decl. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43403 91177308-0d34-0410-b5e6-96231b3b80d8