- Sep 15, 2007
-
-
Steve Naroff authored
Start converting Action methods from Parse-prefix to ActOn-prefix. 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
-
Steve Naroff authored
Rename Action::ParseRecordBody() to ProcessFieldDecls(), and add a 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
-
Steve Naroff authored
Several improvement to Sema::ParseRecordBody()... - 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
-
- Sep 14, 2007
-
-
Fariborz Jahanian authored
llvm-svn: 41961
-
Fariborz Jahanian authored
llvm-svn: 41954
-
Steve Naroff authored
Now that the dust has settled on the Decl refactoring, I noticed FieldDecl 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
-
Steve Naroff authored
Move Decl::NextDeclarator (w/ setters/getters) down to ScopedDecl/FieldDecl. Decl is now svelte:-) llvm-svn: 41935
-
- Sep 13, 2007
-
-
Steve Naroff authored
Phase 2 of making the Decl class more lightweight... 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
-
Fariborz Jahanian authored
llvm-svn: 41932
-
Steve Naroff authored
Add "ScopedDecl" AST, used by ValueDecl and TypeDecl. This allows us to sink the "Next" field, which isn't used by FieldDecl and ObjcIvarDecl. llvm-svn: 41931
-
- Sep 12, 2007
-
-
Steve Naroff authored
diagnostic for illegal initializers. llvm-svn: 41889
-
Fariborz Jahanian authored
to use of @property. llvm-svn: 41880
-
Steve Naroff authored
Fix the following bug submitted by Ted Kremenek: 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
-
- Sep 11, 2007
-
-
Steve Naroff authored
- Add an ObjcIvarDecl AST node (a subclass of FieldDecl). - 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
-
Steve Naroff authored
Fix the following bug submitted by Justin Handville. 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
-
- Sep 10, 2007
-
-
Steve Naroff authored
llvm-svn: 41803
-
Fariborz Jahanian authored
class object. llvm-svn: 41801
-
- Sep 06, 2007
-
-
Steve Naroff authored
The goal of this commit is to get just enough Sema support to recognize 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
-
Ted Kremenek authored
in the actual GotoStmt. Fixed bug where GotoStmt::getSourceRange incorrectly used the target LabelStmt to compute its extent. llvm-svn: 41745
-
- Sep 04, 2007
-
-
Steve Naroff authored
Simplified initializer semantic analysis by adding the following 2 methods: - ArrayType::getBaseType(), and - ConstantArrayType::getMaximumElements(). Wanted to do this cleanup before adding structure support, which will add more complexity. llvm-svn: 41715
-
Steve Naroff authored
Make sure initializer type promotions get propagated. This fixes a recent regression with Codegen/mandel.c. llvm-svn: 41696
-
Chris Lattner authored
llvm-svn: 41693
-
Steve Naroff authored
More fun with initializers! - 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
-
- Sep 03, 2007
-
-
Chris Lattner authored
llvm-svn: 41687
-
Steve Naroff authored
Finish getting "array-init.c" to work properly. Array scalar initialization is now is reasonable shape. Next step, structure and array of structure initializers. llvm-svn: 41681
-
- Sep 02, 2007
-
-
Steve Naroff authored
More progress on array initializers. - Added Expr::isConstantExpr(). - Added type checking for InitListExpr elements. - Added diagnostic for trying to initialize a variable sized object. llvm-svn: 41674
-
Steve Naroff authored
Added 2 errors and one warning, updated test case. llvm-svn: 41672
-
Steve Naroff authored
Start implementing semantic analysis for C initializers. 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
-
- Sep 01, 2007
-
-
Steve Naroff authored
Finish converting SwitchStmt AST to source ranges. 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
-
Steve Naroff authored
Convert more statments over to SourceRanges... llvm-svn: 41666
-
Steve Naroff authored
Move SourceRange protocol from Expr->Stmt. Converted many of the statements over. Still a hanful left... llvm-svn: 41663
-
- Aug 31, 2007
-
-
Chris Lattner authored
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
-
Chris Lattner authored
llvm-svn: 41653
-
Steve Naroff authored
Removed Sema::VerifyConstantArrayType(). With the new 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
-
Anders Carlsson authored
llvm-svn: 41636
-
Chris Lattner authored
llvm-svn: 41635
-
Steve Naroff authored
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
-
Steve Naroff authored
Final phase of array cleanup (for now), removing a FIXME from yesterday. 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
-
- Aug 30, 2007
-
-
Steve Naroff authored
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
-
Chris Lattner authored
llvm-svn: 41615
-