Skip to content
  1. Sep 15, 2007
    • Steve Naroff's avatar
      · 30d242c9
      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
      30d242c9
    • Steve Naroff's avatar
      · 2e688fde
      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
      2e688fde
    • Steve Naroff's avatar
      · db47ee20
      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
      db47ee20
  2. Sep 14, 2007
  3. Sep 13, 2007
    • Steve Naroff's avatar
      · 9def2b15
      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
      9def2b15
    • Fariborz Jahanian's avatar
      Patch for collecting ivars before running action on them. · 6812cbb2
      Fariborz Jahanian authored
      llvm-svn: 41932
      6812cbb2
    • Steve Naroff's avatar
      · 9324db12
      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
      9324db12
  4. Sep 12, 2007
    • Steve Naroff's avatar
      Remove a FIXME. Replace a couple asserts with an appropriate error · 437b4d8b
      Steve Naroff authored
      diagnostic for illegal initializers.
      
      llvm-svn: 41889
      437b4d8b
    • Fariborz Jahanian's avatar
      Patch for building method declaration nodes. Also fixed a segfault in cocoa.m due · cfb31fab
      Fariborz Jahanian authored
      to use of @property.
      
      llvm-svn: 41880
      cfb31fab
    • Steve Naroff's avatar
      · 6109140b
      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
      6109140b
  5. Sep 11, 2007
    • Steve Naroff's avatar
      · f2fb4ad0
      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
      f2fb4ad0
    • Steve Naroff's avatar
      · 4292bde1
      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
      4292bde1
  6. Sep 10, 2007
  7. Sep 06, 2007
    • Steve Naroff's avatar
      · 09bf815f
      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
      09bf815f
    • Ted Kremenek's avatar
      Added LabelLoc to GotoStmt to record the source location of the label token · 73c18e03
      Ted Kremenek authored
      in the actual GotoStmt.
      
      Fixed bug where GotoStmt::getSourceRange incorrectly used the target LabelStmt
      to compute its extent.
      
      llvm-svn: 41745
      73c18e03
  8. Sep 04, 2007
    • Steve Naroff's avatar
      · 67ae4439
      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
      67ae4439
    • Steve Naroff's avatar
      · 77b97002
      Steve Naroff authored
      Make sure initializer type promotions get propagated.
      
      This fixes a recent regression with Codegen/mandel.c.
      
      llvm-svn: 41696
      77b97002
    • Chris Lattner's avatar
      Silence VC++ warnings, patch by Hartmut Kaiser · 9cf21c5a
      Chris Lattner authored
      llvm-svn: 41693
      9cf21c5a
    • Steve Naroff's avatar
      · ac074b4d
      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
      ac074b4d
  9. Sep 03, 2007
  10. Sep 02, 2007
    • Steve Naroff's avatar
      · b03f5940
      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
      b03f5940
    • Steve Naroff's avatar
      More semantic analysis of initializers. · f33527a1
      Steve Naroff authored
      Added 2 errors and one warning, updated test case.
      
      llvm-svn: 41672
      f33527a1
    • Steve Naroff's avatar
      · 2fea1392
      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
      2fea1392
  11. Sep 01, 2007
    • Steve Naroff's avatar
      · 42a350a1
      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
      42a350a1
    • Steve Naroff's avatar
      · dc9f36e6
      Steve Naroff authored
      Convert more statments over to SourceRanges...
      
      llvm-svn: 41666
      dc9f36e6
    • Steve Naroff's avatar
      · 33f3d050
      Steve Naroff authored
      Move SourceRange protocol from Expr->Stmt.
      
      Converted many of the statements over. Still a hanful left...
      
      llvm-svn: 41663
      33f3d050
  12. Aug 31, 2007
    • Chris Lattner's avatar
      Fix a bug/missing-feature Ted noticed: the 'unused' warning should not · cac27a54
      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
      cac27a54
    • Chris Lattner's avatar
      diagnose extended uses of offsetof · 78502cf4
      Chris Lattner authored
      llvm-svn: 41653
      78502cf4
    • Steve Naroff's avatar
      · 096dd942
      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
      096dd942
    • Anders Carlsson's avatar
      Add InitListExpr class. · 4692db0e
      Anders Carlsson authored
      llvm-svn: 41636
      4692db0e
    • Chris Lattner's avatar
      add actions for deleting expr/stmt nodes. · 57c523f5
      Chris Lattner authored
      llvm-svn: 41635
      57c523f5
    • Steve Naroff's avatar
      Sema::ParseCastExpr() missing call to UsualUnaryConversions(). · 43b8f7fa
      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
      43b8f7fa
    • Steve Naroff's avatar
      · d57fa941
      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
      d57fa941
  13. Aug 30, 2007
Loading