summaryrefslogtreecommitdiffstats
path: root/clang/Sema
Commit message (Collapse)AuthorAgeFilesLines
...
* Finish defining Action API for message expressions.Steve Naroff2007-09-172-0/+39
| | | | llvm-svn: 42059
* - Refactored ObjcKeywordInfo into ObjcKeywordInfo, ObjcKeywordDecl, and ↵Steve Naroff2007-09-172-27/+19
| | | | | | | | | | | | ObjcKeywordMessage. - Removed helper ObjcGetSelectorInfo(), moving the code directly into ObjcBuildMethodDeclaration(). - Many refinements to ParseObjCMessageExpression(). - Add ActOnMessageExpression(). Next step, finish the message actions and (finally) create/instantiate an ObjcMessageExpr AST. llvm-svn: 42050
* Add support for ObjC keyword selectors.Steve Naroff2007-09-171-5/+31
| | | | | | | | | | - Add SelectorInfo/SelectorTable classes, modeled after IdentifierInfo/IdentifierTable. - Add SelectorTable instance to ASTContext, created lazily through ASTContext::getSelectorInfo(). - Add SelectorInfo slot to ObjcMethodDecl. - Add helper function to derive a SelectorInfo from ObjcKeywordInfo. Misc: Got the Decl stats stuff up and running again...it was missing support for ObjC AST's. llvm-svn: 42023
* remove some obsolete interfaces.Chris Lattner2007-09-161-26/+0
| | | | llvm-svn: 42014
* Fixes/tweaks that prevent "defaults-i.m" from compiling.Steve Naroff2007-09-163-5/+5
| | | | | | | - Allow classnames as the receiver (removing a FIXME from ParseObjCMessageExpression). - Added a FIXME to ParseObjCMessageExpression()...we need to return a message expr AST node! llvm-svn: 42001
* Rename statement actions (from Parse-prefix to ActOn-prefix).Steve Naroff2007-09-164-62/+62
| | | | llvm-svn: 42000
* Rename expression actions (from Parse-prefix to ActOn-prefix).Steve Naroff2007-09-162-50/+50
| | | | llvm-svn: 41997
* Updated VC++ build system.Hartmut Kaiser2007-09-161-1/+2
| | | | | | Silenced a couple of VC++ warnings. llvm-svn: 41994
* add a new ASTConsumer consumer to simplify stuff in the driver.Chris Lattner2007-09-151-0/+36
| | | | | | Switch -parse-ast over to it. llvm-svn: 41991
* Start converting Action methods from Parse-prefix to ActOn-prefix.Steve Naroff2007-09-154-29/+29
| | | | | | The previous naming scheme was confusing, since it resulted in both the Parser and Action modules having methods with the same name. In addition, the Action module never does any parsing... llvm-svn: 41986
* Rename Action::ParseRecordBody() to ProcessFieldDecls(), and add a ↵Steve Naroff2007-09-142-44/+34
| | | | | | | | | | visibility argument. Remove Action::ObjcAddVisibilityToIvars(). No need for an extra API when it is trivial to add this info to the previous hook. In general, I want to start migrating away from having Actions prefixed with "Parse" (which is confusing, since the Action API doesn't do any parsing, per se). llvm-svn: 41973
* Several improvement to Sema::ParseRecordBody()...Steve Naroff2007-09-141-26/+24
| | | | | | | | - Adding a safer prologue. The previous prologue would accept a null and therefore assume we had an interface (which was incorrect). - Fixed FieldDecl's classof method. This allowed me to simplify some unnecessary casting. - When diagnosing errors, make sure the FieldDecl/EnclosingDecl are marked as invalid. In addition, don't delete the field...rather, add all fields to the enclosing decl. Memory management can/should be done elsewhere. This code was never "upgraded" to the recently added invalid decl strategy. llvm-svn: 41964
* Patch to store ivars into interface class object.Fariborz Jahanian2007-09-142-6/+12
| | | | llvm-svn: 41961
* Semantic analysis for objective-c ivars.Fariborz Jahanian2007-09-141-9/+24
| | | | llvm-svn: 41954
* Now that the dust has settled on the Decl refactoring, I noticed FieldDecl ↵Steve Naroff2007-09-141-2/+2
| | | | | | | | didn't need NextDeclarator. As a result, I'm removing it. Removing both slots (NextDeclarator/Next) end up reducing the size of fields/ivars by 40%. llvm-svn: 41948
* Move Decl::NextDeclarator (w/ setters/getters) down to ScopedDecl/FieldDecl.Steve Naroff2007-09-133-11/+12
| | | | | | Decl is now svelte:-) llvm-svn: 41935
* Phase 2 of making the Decl class more lightweight...Steve Naroff2007-09-133-13/+18
| | | | | | | | Move Identifier/Loc instance variables (and associated getters/setters) down from Decl to ScopedDecl/FieldDecl. Objc AST's can now inherit from Decl without getting instance variables and types that are C specific. For now, I am keeping NextDeclarator, since I believe it may be useful to ObjC. If not, it can be moved later. llvm-svn: 41934
* Patch for collecting ivars before running action on them.Fariborz Jahanian2007-09-132-23/+29
| | | | llvm-svn: 41932
* Add "ScopedDecl" AST, used by ValueDecl and TypeDecl. Steve Naroff2007-09-132-20/+24
| | | | | | This allows us to sink the "Next" field, which isn't used by FieldDecl and ObjcIvarDecl. llvm-svn: 41931
* Remove a FIXME. Replace a couple asserts with an appropriate errorSteve Naroff2007-09-121-17/+16
| | | | | | diagnostic for illegal initializers. llvm-svn: 41889
* Patch for building method declaration nodes. Also fixed a segfault in ↵Fariborz Jahanian2007-09-122-3/+48
| | | | | | | | cocoa.m due to use of @property. llvm-svn: 41880
* Fix the following bug submitted by Ted Kremenek:Steve Naroff2007-09-122-86/+104
| | | | | | | | | | | | | | | | | | | | | | void func() { int xx = xx; // incorrectly diagnosed 'xx' as an undeclared identifier. } This smallish bug resulted in a largish fix. Here are some highlights: - Needed to make sure ParseDeclarator is called *before* parsing any initializer. Removed the "Init" argument to ParseDeclarator. - Added AddInitializerToDecl() to the Action & Sema classes. In Sema, this hook is responsible for validating the initializer and installing it into the respective decl. - Moved several semantic checks from ParseDeclarator() to FinalizeDeclaratorGroup(). Previously, this hook was only responsible for reversing a list. Now it plays a much larger semantic role. All of the above changes ended up simplifying ParseDeclarator(), which is goodness... llvm-svn: 41877
* - Add an ObjcIvarDecl AST node (a subclass of FieldDecl).Steve Naroff2007-09-112-4/+43
| | | | | | | - Instantiate the node in Sema::ParseField(), based on the type of the TagDecl. - Add Sema::ObjcAddInstanceVariable(), responsible for adorning/adding the ObjcIvarDecl. llvm-svn: 41864
* Fix the following bug submitted by Justin Handville.Steve Naroff2007-09-101-2/+19
| | | | | | | | | | | | | | | | | | | | int main(int argc, char* argv[]) { return 0; } After speaking briefly with Chris, we decided this should be a front-end fix. The fix...have Sema::GetTypeForDeclarator() do the default function/array conversion, as I outlined in the 9/9 email on this topic. Since this conversion is done before Sema::ParseParamDeclarator(), I thought I could remove the conversion from Sema::ParseParamDeclarator(). Unfortunately, this didn't work. The conversion apparently needs to be done in both places (which doesn't make sense to me). Will investigate. llvm-svn: 41811
* Some small tweaks to the recent Objc support...Steve Naroff2007-09-101-0/+1
| | | | llvm-svn: 41803
* Early patch to collect objective-c methods inserts them inFariborz Jahanian2007-09-102-0/+26
| | | | | | class object. llvm-svn: 41801
* The goal of this commit is to get just enough Sema support to recognize ↵Steve Naroff2007-09-063-1/+59
| | | | | | | | | | | Objective-C classes as types. That said, the AST nodes ObjcInterfaceDecl, ObjcInterfaceType, and ObjcClassDecl are *very* preliminary. The good news is we no longer need -parse-noop (aka MinimalActions) to parse cocoa.m. llvm-svn: 41752
* Added LabelLoc to GotoStmt to record the source location of the label tokenTed Kremenek2007-09-061-1/+1
| | | | | | | | | in the actual GotoStmt. Fixed bug where GotoStmt::getSourceRange incorrectly used the target LabelStmt to compute its extent. llvm-svn: 41745
* Simplified initializer semantic analysis by adding the following 2 methods:Steve Naroff2007-09-041-48/+11
| | | | | | | | | - ArrayType::getBaseType(), and - ConstantArrayType::getMaximumElements(). Wanted to do this cleanup before adding structure support, which will add more complexity. llvm-svn: 41715
* Make sure initializer type promotions get propagated.Steve Naroff2007-09-042-8/+13
| | | | | | This fixes a recent regression with Codegen/mandel.c. llvm-svn: 41696
* Silence VC++ warnings, patch by Hartmut KaiserChris Lattner2007-09-043-12/+16
| | | | llvm-svn: 41693
* More fun with initializers! Steve Naroff2007-09-042-34/+121
| | | | | | | | | - Fixed many bugs, enhanced test case considerably, added a diagnostic, etc. - Refactored CheckInitList() into CheckVariableInitList()/CheckConstantInitList(). - Added CheckInitExpr(). - Support for multi-dimensional arrays looking good. llvm-svn: 41690
* Add a method required by the VC++ STL, patch by Hartmut Kaiser!Chris Lattner2007-09-031-0/+4
| | | | llvm-svn: 41687
* Finish getting "array-init.c" to work properly.Steve Naroff2007-09-033-29/+60
| | | | | | | | Array scalar initialization is now is reasonable shape. Next step, structure and array of structure initializers. llvm-svn: 41681
* More progress on array initializers.Steve Naroff2007-09-023-10/+31
| | | | | | | | - Added Expr::isConstantExpr(). - Added type checking for InitListExpr elements. - Added diagnostic for trying to initialize a variable sized object. llvm-svn: 41674
* More semantic analysis of initializers.Steve Naroff2007-09-022-3/+43
| | | | | | Added 2 errors and one warning, updated test case. llvm-svn: 41672
* Start implementing semantic analysis for C initializers.Steve Naroff2007-09-023-8/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Step 1: Start instantiating InitListExpr's. Step 2: Call newly added function Sema::CheckInitializer() from Sema::ParseDeclarator(). Step 3: Give InitListExpr's a preliminary type. Step 4: Start emitting diagnostics for simple assignments. Note: As a result of step 1, the CodeGen/mandel.c test asserts "Unimplemented agg expr!", which is expected. As a result of step 4, the test below now fails. This isn't expected and needs to be investigated (it appears type checking for C++ references is flawed in some way). ******************** TEST 'Sema/cxx-references.cpp' FAILED! ******************** Command: clang -fsyntax-only Sema/cxx-references.cpp Output: Sema/cxx-references.cpp:8:12: warning: incompatible pointer types assigning 'int &*' to 'int *' int *p = &r; ^~ Sema/cxx-references.cpp:10:20: error: incompatible types assigning 'int (int)' to 'int (&)(int)' int (&rg)(int) = g; ^ Sema/cxx-references.cpp:13:18: error: incompatible types assigning 'int [3]' to 'int (&)[3]' int (&ra)[3] = a; ^ Sema/cxx-references.cpp:16:14: error: incompatible types assigning 'int *' to 'int *&' int *& P = Q; ^ 4 diagnostics generated. ******************** TEST 'Sema/cxx-references.cpp' FAILED! ******************** llvm-svn: 41671
* Finish converting SwitchStmt AST to source ranges.Steve Naroff2007-09-011-1/+1
| | | | | | | | | | Move DumpSourceRange() to DumpStmt(). Now -parse-ast-dump will display source range info for all stmts/exprs. One day we should implement the source range protocol for Decls. llvm-svn: 41670
* Convert more statments over to SourceRanges...Steve Naroff2007-08-311-6/+6
| | | | llvm-svn: 41666
* Move SourceRange protocol from Expr->Stmt.Steve Naroff2007-08-311-7/+6
| | | | | | Converted many of the statements over. Still a hanful left... llvm-svn: 41663
* Fix a bug/missing-feature Ted noticed: the 'unused' warning should notChris Lattner2007-08-312-22/+29
| | | | | | | | | | warn about the last stmt in a stmtexpr, f.e. there should be no warning for: int maxval_stmt_expr(int x, int y) { return ({int _a = x, _b = y; _a > _b ? _a : _b; }); } llvm-svn: 41655
* diagnose extended uses of offsetofChris Lattner2007-08-311-0/+6
| | | | llvm-svn: 41653
* Removed Sema::VerifyConstantArrayType(). With the new ↵Steve Naroff2007-08-312-40/+31
| | | | | | | | | | | | | | | | | Array/ConstantArray/VariableArray nodes, this routine was causing more trouble than it was worth. Anders/Chris noticed that it could return an error code without emiting a diagnostic (which results in an silent invalid decl, which should *never* happen). In addition, this routine didn't work well for typedefs and field decls. Lastly, it didn't consider that initializers aren't in place yet. Added Type::getAsConstantArrayType(), Type::getAsVariableArrayType(), Type::getAsVariablyModifiedType(), and Type::isVariablyModifiedType(); Modified Sema::ParseDeclarator() and Sema::ParseField() to use the new predicates. Also added a FIXME for the initializer omission. Also added a missing test for "static" @ file scope. llvm-svn: 41647
* Add InitListExpr class.Anders Carlsson2007-08-311-2/+6
| | | | llvm-svn: 41636
* add actions for deleting expr/stmt nodes.Chris Lattner2007-08-312-0/+10
| | | | llvm-svn: 41635
* Sema::ParseCastExpr() missing call to UsualUnaryConversions().Steve Naroff2007-08-311-0/+2
| | | | | | | | | | | | | | | | The following case now works... void empty(void * a ) {} void test() { unsigned char A[4]; empty( (void *) A); } Thanks to Patrick Flannery for finding this... llvm-svn: 41630
* Final phase of array cleanup (for now), removing a FIXME from yesterday.Steve Naroff2007-08-302-42/+25
| | | | | | | | | | | | | | | | | | | | | | Moved several array constraints checks from Sema::VerifyConstantArrayType() to Sema::GetTypeForDeclarator(). VerifyConstantArrayType() is now very simple, and could be removed eventually. Now, we get the following (correct) messages for BlockVarDecls:-) [dylan:~/llvm/tools/clang] admin% ../../Debug/bin/clang x.c -pedantic x.c:4:20: error: size of array has non-integer type 'float' int size_not_int[f]; ^ x.c:5:21: error: array size is negative int negative_size[1-2]; ^~~ x.c:6:17: warning: zero size arrays are an extension int zero_size[0]; ^ 3 diagnostics generated. llvm-svn: 41624
* Polish yesterday's Array/ConstantArray/VariableArray rewrite, removing a ↵Steve Naroff2007-08-301-2/+7
| | | | | | | | | couple FIXME's. Refactored Array/VariableArray, moving SizeModifier/IndexTypeQuals back up to Array. These attributes are not specific to VLA's. Most of them are specific to array parameter types. llvm-svn: 41616
* implement pretty printing of offsetofChris Lattner2007-08-301-0/+6
| | | | llvm-svn: 41615
* implement initial sema support for __builtin_offsetofChris Lattner2007-08-302-10/+82
| | | | llvm-svn: 41613
OpenPOWER on IntegriCloud