Skip to content
  1. Feb 15, 2012
    • Douglas Gregor's avatar
      Specialize noreturn diagnostics for lambda expressions. · cf11eb76
      Douglas Gregor authored
      llvm-svn: 150586
      cf11eb76
    • Douglas Gregor's avatar
      Fix silly precedence error. · 85dae892
      Douglas Gregor authored
      llvm-svn: 150585
      85dae892
    • Douglas Gregor's avatar
      Specialize the diagnostic complaining about conflicting types of · b9e38f19
      Douglas Gregor authored
      return statements within a lambda; this diagnostic previously referred
      to blocks.
      
      llvm-svn: 150584
      b9e38f19
    • Douglas Gregor's avatar
      Implement code completion support for lambda capture lists. · d8c61785
      Douglas Gregor authored
      llvm-svn: 150583
      d8c61785
    • Hans Wennborg's avatar
      Make -Wformat fix-its preserve original conversion specifiers. · d99d6883
      Hans Wennborg authored
      This commit makes PrintfSpecifier::fixType() and ScanfSpecifier::fixType()
      only fix a conversion specification enough that Clang wouldn't warn about it,
      as opposed to always changing it to use the "canonical" conversion specifier.
      (PR11975)
      
      This preserves the user's choice of conversion specifier in cases like:
      
      printf("%a", (long double)1);
      where we previously suggested "%Lf", we now suggest "%La"
      
      printf("%x", (long)1);
      where we previously suggested "%ld", we now suggest "%lx".
      
      llvm-svn: 150578
      d99d6883
    • Richard Smith's avatar
      If a static data member of a class template which could be used in a constant · d3cf238e
      Richard Smith authored
      expression is referenced, defined, then referenced again, make sure we
      instantiate it the second time it's referenced. This is the static data member
      analogue of r150518.
      
      llvm-svn: 150560
      d3cf238e
    • John McCall's avatar
      Split reinterpret_casts of member pointers out from CK_BitCast; this · c62bb391
      John McCall authored
      is general goodness because representations of member pointers are
      not always equivalent across member pointer types on all ABIs
      (even though this isn't really standard-endorsed).
      
      Take advantage of the new information to teach IR-generation how
      to do these reinterprets in constant initializers.  Make sure this
      works when intermingled with hierarchy conversions (although
      this is not part of our motivating use case).  Doing this in the
      constant-evaluator would probably have been better, but that would
      require a *lot* of extra structure in the representation of
      constant member pointers:  you'd really have to track an arbitrary
      chain of hierarchy conversions and reinterpretations in order to
      get this right.  Ultimately, this seems less complex.  I also
      wasn't quite sure how to extend the constant evaluator to handle
      foldings that we don't actually want to treat as extended
      constant expressions.
      
      llvm-svn: 150551
      c62bb391
  2. Feb 14, 2012
  3. Feb 13, 2012
    • Richard Smith's avatar
      Deal with a horrible C++11 special case. If a non-literal type has a constexpr · 6331c408
      Richard Smith authored
      constructor, and that constructor is used to initialize an object of static
      storage duration such that all members and bases are initialized by constant
      expressions, constant initialization is performed. In this case, the object
      can still have a non-trivial destructor, and if it does, we must emit a dynamic
      initializer which performs no initialization and instead simply registers that
      destructor.
      
      llvm-svn: 150419
      6331c408
    • Douglas Gregor's avatar
      Introduce support for template instantiation of lambda · 0c46b2b7
      Douglas Gregor authored
      expressions. This is mostly a simple refact, splitting the main "start
      a lambda expression" function into smaller chunks that are driven
      either from the parser (Sema::ActOnLambdaExpr) or during AST
      transformation (TreeTransform::TransformLambdaExpr). A few minor
      interesting points:
      
        - Added new entry points for TreeTransform, so that we can
        explicitly establish the link between the lambda closure type in the
        template and the lambda closure type in the instantiation.
        - Added a bit into LambdaExpr specifying whether it had an explicit
        result type or not. We should have had this anyway.
      
      This code is 'lightly' tested.
      
      llvm-svn: 150417
      0c46b2b7
    • Sebastian Redl's avatar
      Don't route explicit construction via list-initialization through the... · 2b80af49
      Sebastian Redl authored
      Don't route explicit construction via list-initialization through the functional cast code path. It sometimes does the wrong thing, produces horrible error messages, and is just unnecessary.
      
      llvm-svn: 150408
      2b80af49
    • Douglas Gregor's avatar
      Keep track of the set of array index variables we use when we · 54fcea6e
      Douglas Gregor authored
      synthesize a by-copy captured array in a lambda. This information will
      be needed by IR generation.
      
      llvm-svn: 150396
      54fcea6e
    • Douglas Gregor's avatar
      Move the storage of lambda captures and capture initializers from · c8a73493
      Douglas Gregor authored
      LambdaExpr over to the CXXRecordDecl. This allows us to eliminate the
      back-link from the closure type to the LambdaExpr, which will simplify
      and lazify AST deserialization.
      
      llvm-svn: 150393
      c8a73493
    • Richard Smith's avatar
      Update constexpr implementation to match CWG's chosen approach for core issues · 3607ffee
      Richard Smith authored
      1358, 1360, 1452 and 1453.
       - Instantiations of constexpr functions are always constexpr. This removes the
         need for separate declaration/definition checking, which is now gone.
       - This makes it possible for a constexpr function to be virtual, if they are
         only dependently virtual. Virtual calls to such functions are not constant
         expressions.
       - Likewise, it's now possible for a literal type to have virtual base classes.
         A constexpr constructor for such a type cannot actually produce a constant
         expression, though, so add a special-case diagnostic for a constructor call
         to such a type rather than trying to evaluate it.
       - Classes with trivial default constructors (for which value initialization can
         produce a fully-initialized value) are considered literal types.
       - Classes with volatile members are not literal types.
       - constexpr constructors can be members of non-literal types. We do not yet use
         static initialization for global objects constructed in this way.
      
      llvm-svn: 150359
      3607ffee
  4. Feb 12, 2012
    • Douglas Gregor's avatar
      Implement the standard decltype() semantics described in C++11 · e096a355
      Douglas Gregor authored
      [dcl.type.simple]p4, which treats all xvalues as returning T&&. We had
      previously implemented a pre-standard variant of decltype() that
      doesn't cope with, e.g., static_ast<T&&>(e) very well.
      
      llvm-svn: 150348
      e096a355
    • Douglas Gregor's avatar
      Within the body of a lambda expression, decltype((x)) for an · 81495f34
      Douglas Gregor authored
      id-expression 'x' will compute the type based on the assumption that
      'x' will be captured, even if it isn't captured, per C++11
      [expr.prim.lambda]p18. There are two related refactors that go into
      implementing this:
      
        1) Split out the check that determines whether we should capture a
        particular variable reference, along with the computation of the
        type of the field, from the actual act of capturing the
        variable. 
        2) Always compute the result of decltype() within Sema, rather than
        AST, because the decltype() computation is now context-sensitive.
      
      llvm-svn: 150347
      81495f34
    • Sebastian Redl's avatar
      Proper initializer list support for new expressions and type construct... · d74dd490
      Sebastian Redl authored
      Proper initializer list support for new expressions and type construct expressions. Array new still missing.
      
      llvm-svn: 150346
      d74dd490
    • Douglas Gregor's avatar
      Lambdas have a deleted default constructor and a deleted copy · 1a22d288
      Douglas Gregor authored
      assignment operator, per C++ [expr.prim.lambda]p19. Make it so.
      
      llvm-svn: 150345
      1a22d288
    • Sebastian Redl's avatar
      Change the way we store initialization kinds so that all direct inits can... · 0501c636
      Sebastian Redl authored
      Change the way we store initialization kinds so that all direct inits can distinguish between list and parens form. This allows us to correctly diagnose the last test cases from litb.
      
      llvm-svn: 150343
      0501c636
    • Sebastian Redl's avatar
    • Sebastian Redl's avatar
      Represent C++ direct initializers as ParenListExprs before semantic analysis · a935179a
      Sebastian Redl authored
      instead of having a special-purpose function.
      
      - ActOnCXXDirectInitializer, which was mostly duplication of
        AddInitializerToDecl (leading e.g. to PR10620, which Eli fixed a few days
        ago), is dropped completely.
      - MultiInitializer, which was an ugly hack I added, is dropped again.
      - We now have the infrastructure in place to distinguish between
        int x = {1};
        int x({1});
        int x{1};
      -- VarDecl now has getInitStyle(), which indicates which of the above was used.
      -- CXXConstructExpr now has a flag to indicate that it represents list-
         initialization, although this is not yet used.
      - InstantiateInitializer was renamed to SubstInitializer and simplified.
      - ActOnParenOrParenListExpr has been replaced by ActOnParenListExpr, which
        always produces a ParenListExpr. Placed that so far failed to convert that
        back to a ParenExpr containing comma operators have been fixed. I'm pretty
        sure I could have made a crashing test case before this.
      
      The end result is a (I hope) considerably cleaner design of initializers.
      More importantly, the fact that I can now distinguish between the various
      initialization kinds means that I can get the tricky generalized initializer
      test cases Johannes Schaub supplied to work. (This is not yet done.)
      
      This commit passed self-host, with the resulting compiler passing the tests. I
      hope it doesn't break more complicated code. It's a pretty big change, but one
      that I feel is necessary.
      
      llvm-svn: 150318
      a935179a
    • Sebastian Redl's avatar
      Fix parsing new expressions using init lists. Probably still do the wrong... · 82ace98d
      Sebastian Redl authored
      Fix parsing new expressions using init lists. Probably still do the wrong thing in cases involving array new.
      Show that many cases using initializer list constructors work, in that they parse and pass semantic analysis.
      
      llvm-svn: 150316
      82ace98d
  5. Feb 11, 2012
  6. Feb 10, 2012
Loading