Skip to content
  1. 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
    • Sebastian Redl's avatar
      Parse deleted member functions. Parsing member declarations goes through a... · 42e92c4b
      Sebastian Redl authored
      Parse deleted member functions. Parsing member declarations goes through a different code path that I forgot previously.
      Implement the rvalue reference overload dance for returning local objects. Returning a local object first tries to find a move constructor now.
      The error message when no move constructor is defined (or is not applicable) and the copy constructor is deleted is quite ugly, though.
      
      llvm-svn: 68902
      42e92c4b
    • Chris Lattner's avatar
      implement rdar://6780761, making sema reject some code that otherwise · a8a7d0f3
      Chris Lattner authored
      crashes codegen.
      
      llvm-svn: 68891
      a8a7d0f3
  2. Apr 11, 2009
  3. Apr 07, 2009
  4. Apr 06, 2009
  5. Apr 02, 2009
  6. Apr 01, 2009
    • Douglas Gregor's avatar
      Make parsing a semantic analysis a little more robust following Sema · fe3d7d08
      Douglas Gregor authored
      failures that involve malformed types, e.g., "typename X::foo" where
      "foo" isn't a type, or "std::vector<void>" that doens't instantiate
      properly.
      
      Similarly, be a bit smarter in our handling of ambiguities that occur
      in Sema::getTypeName, to eliminate duplicate error messages about
      ambiguous name lookup.
      
      This eliminates two XFAILs in test/SemaCXX, one of which was crying
      out to us, trying to tell us that we were producing repeated error
      messages.
      
      llvm-svn: 68251
      fe3d7d08
    • Douglas Gregor's avatar
      Parsing, semantic analysis, and template instantiation for typename · dce2b62b
      Douglas Gregor authored
      specifiers that terminate in a simple-template-id, e.g.,
      
        typename MetaFun::template apply<T1, T2>
      
      Also, implement template instantiation for dependent
      nested-name-specifiers that involve unresolved identifiers, e.g.,
      
        typename T::type::type
      
      llvm-svn: 68166
      dce2b62b
  7. Mar 31, 2009
    • Douglas Gregor's avatar
      Implement template instantiation for template names, including both · aa59489b
      Douglas Gregor authored
      template template parameters and dependent template names. For
      example, the oft-mentioned
      
        typename MetaFun::template apply<T1, T2>::type
      
      can now be instantiated, with the appropriate name lookup for "apply".
      
      llvm-svn: 68128
      aa59489b
    • Douglas Gregor's avatar
      Parsing and AST representation for dependent template names that occur · b67535d1
      Douglas Gregor authored
      within nested-name-specifiers, e.g., for the "apply" in
      
        typename MetaFun::template apply<T1, T2>::type
      
      At present, we can't instantiate these nested-name-specifiers, so our
      testing is sketchy.
      
      llvm-svn: 68081
      b67535d1
    • Douglas Gregor's avatar
      Improve the representation of template names in the AST. This · dc572a32
      Douglas Gregor authored
      representation handles the various ways in which one can name a
      template, including unqualified references ("vector"), qualified
      references ("std::vector"), and dependent template names
      ("MetaFun::template apply").
      
      One immediate effect of this change is that the representation of
      nested-name-specifiers in type names for class template
      specializations (e.g., std::vector<int>) is more accurate. Rather than
      representing std::vector<int> as
      
        std::(vector<int>)
      
      we represent it as
      
        (std::vector)<int>
      
      which more closely follows the C++ grammar. 
      
      Additionally, templates are no longer represented as declarations
      (DeclPtrTy) in Parse-Sema interactions. Instead, I've introduced a new
      OpaquePtr type (TemplateTy) that holds the representation of a
      TemplateName. This will simplify the handling of dependent
      template-names, once we get there.
      
      llvm-svn: 68074
      dc572a32
  8. Mar 29, 2009
    • Chris Lattner's avatar
      Push DeclGroup much farther throughout the compiler. Now the various · 5bbb3c8a
      Chris Lattner authored
      productions (except the already broken ObjC cases like @class X,Y;) in 
      the parser that can produce more than one Decl return a DeclGroup instead
      of a Decl, etc.
      
      This allows elimination of the Decl::NextDeclarator field, and exposes
      various clients that should look at all decls in a group, but which were
      only looking at one (such as the dumper, printer, etc).  These have been
      fixed.
      
      Still TODO:
      
      1) there are some FIXME's in the code about potentially using
      DeclGroup for better location info.
      2) ParseObjCAtDirectives should return a DeclGroup due to @class etc.
      3) I'm not sure what is going on with StmtIterator.cpp, or if it can
         be radically simplified now.
      4) I put a truly horrible hack in ParseTemplate.cpp.
      
      I plan to bring up #3/4 on the mailing list, but don't plan to tackle
      #1/2 in the short term.
      
      llvm-svn: 68002
      5bbb3c8a
    • Anders Carlsson's avatar
      More improvements to namespace aliases. We now support everything except... · bb1e4724
      Anders Carlsson authored
      More improvements to namespace aliases. We now support everything except aliases in using directives.
      
      llvm-svn: 67966
      bb1e4724
  9. Mar 28, 2009
    • Anders Carlsson's avatar
    • Chris Lattner's avatar
      Introduce a new OpaquePtr<N> struct type, which is a simple POD wrapper for a · 83f095cc
      Chris Lattner authored
      pointer.  Its purpose in life is to be a glorified void*, but which does not
      implicitly convert to void* or other OpaquePtr's with a different UID.
      
      Introduce Action::DeclPtrTy which is a typedef for OpaquePtr<0>.  Change the 
      entire parser/sema interface to use DeclPtrTy instead of DeclTy*.  This
      makes the C++ compiler enforce that these aren't convertible to other opaque
      types.
      
      We should also convert ExprTy, StmtTy, TypeTy, AttrTy, BaseTy, etc,
      but I don't plan to do that in the short term.
      
      The one outstanding known problem with this patch is that we lose the 
      bitmangling optimization where ActionResult<DeclPtrTy> doesn't know how to
      bitmangle the success bit into the low bit of DeclPtrTy.  I will rectify
      this with a subsequent patch.
      
      llvm-svn: 67952
      83f095cc
    • Anders Carlsson's avatar
      9205d553
    • Eli Friedman's avatar
      Change compound assignment operators to keep track of both the promoted · 8b7b1b1a
      Eli Friedman authored
      LHS type and the computation result type; this encodes information into 
      the AST which is otherwise non-obvious.  Fix Sema to always come up with the 
      right answer for both of these types.  Fix IRGen and the analyzer to 
      account for these changes.  This fixes PR2601.  The approach is inspired 
      by PR2601 comment 2.
      
      Note that this changes real *= complex in CodeGen from a silent 
      miscompilation to an explicit error.
      
      I'm not really sure that the analyzer changes are correct, or how to 
      test them... someone more familiar with the analyzer should check those 
      changes.
      
      llvm-svn: 67889
      8b7b1b1a
    • Douglas Gregor's avatar
      Make our diagnostics about the obsolete GNU designated-initializer · 5c7c9cb6
      Douglas Gregor authored
      syntax into extension warnings, and provide code-modification hints
      showing how to fix the problem.
      
      llvm-svn: 67885
      5c7c9cb6
    • Douglas Gregor's avatar
      Initial implementation of parsing, semantic analysis, and template · 333489bb
      Douglas Gregor authored
      instantiation for C++ typename-specifiers such as
      
        typename T::type
      
      The parsing of typename-specifiers is relatively easy thanks to
      annotation tokens. When we see the "typename", we parse the
      typename-specifier and produce a typename annotation token. There are
      only a few places where we need to handle this. We currently parse the
      typename-specifier form that terminates in an identifier, but not the
      simple-template-id form, e.g.,
      
        typename T::template apply<U, V>
      
      Parsing of nested-name-specifiers has a similar problem, since at this
      point we don't have any representation of a class template
      specialization whose template-name is unknown.
      
      Semantic analysis is only partially complete, with some support for
      template instantiation that works for simple examples. 
      
      llvm-svn: 67875
      333489bb
  10. Mar 27, 2009
  11. Mar 26, 2009
  12. Mar 25, 2009
  13. Mar 24, 2009
    • Sebastian Redl's avatar
      f769df5e
    • Anders Carlsson's avatar
      Fix the bug that Eli noticed where we wouldn't look at function decls outside... · b57738b0
      Anders Carlsson authored
      Fix the bug that Eli noticed where we wouldn't look at function decls outside the class declaration.
      
      llvm-svn: 67627
      b57738b0
    • Anders Carlsson's avatar
      More work on diagnosing abstract classes. We can now handle cases like · b5a27b46
      Anders Carlsson authored
      class C {
        void g(C c);
      
        virtual void f() = 0;
      };
      
      In this case, C is not known to be abstract when doing semantic analysis on g. This is done by recursively traversing the abstract class and checking the types of member functions. 
      
      llvm-svn: 67594
      b5a27b46
    • Douglas Gregor's avatar
      Template instantiation for the declarations of member functions within · f4f296de
      Douglas Gregor authored
      a class template. At present, we can only instantiation normal
      methods, but not constructors, destructors, or conversion operators.
      
      As ever, this contains a bit of refactoring in Sema's type-checking. In
      particular:
      
        - Split ActOnFunctionDeclarator into ActOnFunctionDeclarator
          (handling the declarator itself) and CheckFunctionDeclaration
          (checking for the the function declaration), the latter of which
          is also used by template instantiation.
        - We were performing the adjustment of function parameter types in
          three places; collect those into a single new routine.
        - When the type of a parameter is adjusted, allocate an
          OriginalParmVarDecl to keep track of the type as it was written.
        - Eliminate a redundant check for out-of-line declarations of member
          functions; hide more C++-specific checks on function declarations
          behind if(getLangOptions().CPlusPlus).
      
      llvm-svn: 67575
      f4f296de
  14. Mar 23, 2009
  15. Mar 22, 2009
  16. Mar 21, 2009
  17. Mar 20, 2009
Loading