Skip to content
  1. Apr 13, 2009
  2. Apr 12, 2009
    • Chris Lattner's avatar
      Diagnose invalid uses of tagged types with a missing tag. For example, in: · ffaa0e69
      Chris Lattner authored
      struct xyz { int y; };
      enum abc { ZZZ };
      
      static xyz b;
      abc c;
      
      we used to produce:
      
      t2.c:4:8: error: unknown type name 'xyz'
      static xyz b;
             ^
      t2.c:5:1: error: unknown type name 'abc'
      abc c;
      ^
      
      we now produce:
      
      t2.c:4:8: error: use of tagged type 'xyz' without 'struct' tag
      static xyz b;
             ^
             struct
      t2.c:5:1: error: use of tagged type 'abc' without 'enum' tag
      abc c;
      ^
      enum
      
      GCC produces the normal:
      t2.c:4: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘b’
      t2.c:5: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘c’
      
      rdar://6783347
      
      llvm-svn: 68914
      ffaa0e69
    • Chris Lattner's avatar
      fix a valgrind problem I noticed while developing another patch, · 14bdb784
      Chris Lattner authored
      if a decl is invalid, it isn't added to the Decls array, so we
      need to pass in Decls.size() to avoid reading uninit memory.
      
      llvm-svn: 68913
      14bdb784
    • Chris Lattner's avatar
      Implement the first set of changes for PR3963 and rdar://6759604, · 6cc055af
      Chris Lattner authored
      which tries to do better error recovery when it is "obvious" that an
      identifier is a mis-typed typename.  In this case, we try to parse
      it as a typename instead of as the identifier in a declarator, which
      gives us several options for better error recovery and immediately
      makes diagnostics more useful.  For example, we now produce:
      
      t.c:4:8: error: unknown type name 'foo_t'
      static foo_t a = 4;
             ^
      
      instead of:
      
      t.c:4:14: error: invalid token after top level declarator
      static foo_t a = 4;
                   ^
      
      Also, since we now parse "a" correctly, we make a decl for it,
      preventing later uses of 'a' from emitting things like:
      
      t.c:12:20: error: use of undeclared identifier 'a'
      int bar() { return a + b; }
                         ^
      
      I'd really appreciate any scrutiny possible on this, it 
      is a tricky area.
      
      llvm-svn: 68911
      6cc055af
    • Chris Lattner's avatar
      add a new isNull() method to DeclGroupRef. · cbafe8d7
      Chris Lattner authored
      llvm-svn: 68909
      cbafe8d7
    • Chris Lattner's avatar
      a few cleanups to StatementCreatesScope: unnest the whole thing, · 8279ceab
      Chris Lattner authored
      exit at the first decl found that creates a scope, don't evaluate
      decl_end() every iteration.
      
      llvm-svn: 68908
      8279ceab
    • Chris Lattner's avatar
      add a new Decl::hasAttr<T>() predicate. · 423bcb53
      Chris Lattner authored
      llvm-svn: 68907
      423bcb53
    • Fariborz Jahanian's avatar
      OS dependent code removed. · 8e23171f
      Fariborz Jahanian authored
      llvm-svn: 68904
      8e23171f
Loading