Skip to content
Snippets Groups Projects
  1. Jun 28, 2016
    • Richard Smith's avatar
      P0136R1, DR1573, DR1645, DR1715, DR1736, DR1903, DR1941, DR1959, DR1991: · 5be817d9
      Richard Smith authored
      Replace inheriting constructors implementation with new approach, voted into
      C++ last year as a DR against C++11.
      
      Instead of synthesizing a set of derived class constructors for each inherited
      base class constructor, we make the constructors of the base class visible to
      constructor lookup in the derived class, using the normal rules for
      using-declarations.
      
      For constructors, UsingShadowDecl now has a ConstructorUsingShadowDecl derived
      class that tracks the requisite additional information. We create shadow
      constructors (not found by name lookup) in the derived class to model the
      actual initialization, and have a new expression node,
      CXXInheritedCtorInitExpr, to model the initialization of a base class from such
      a constructor. (This initialization is special because it performs real perfect
      forwarding of arguments.)
      
      In cases where argument forwarding is not possible (for inalloca calls,
      variadic calls, and calls with callee parameter cleanup), the shadow inheriting
      constructor is not emitted and instead we directly emit the initialization code
      into the caller of the inherited constructor.
      
      Note that this new model is not perfectly compatible with the old model in some
      corner cases. In particular:
       * if B inherits a private constructor from A, and C uses that constructor to
         construct a B, then we previously required that A befriends B and B
         befriends C, but the new rules require A to befriend C directly, and
       * if a derived class has its own constructors (and so its implicit default
         constructor is suppressed), it may still inherit a default constructor from
         a base class
      
      
      git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@274049 91177308-0d34-0410-b5e6-96231b3b80d8
      5be817d9
  2. Jun 01, 2016
    • Etienne Bergeron's avatar
      [Sema] Fix incorrect enum token namespace · 06caa0fe
      Etienne Bergeron authored
      Summary:
      This patch fix the scoping of enum literal. They were not resolving
      to the right type.
      
      It was not causing any problem as one is a copy of the other one.
      
      The literal in the switch are resolving to Sema.h:5527
      ```
        enum AccessResult {
          AR_accessible,
          AR_inaccessible,
          AR_dependent,
          AR_delayed
        };
      ```
      
      Instead of SemaAccess.cpp:27
      ```
      /// A copy of Sema's enum without AR_delayed.
      enum AccessResult {
        AR_accessible,
        AR_inaccessible,
        AR_dependent
      };
      ```
      
      This issue was found by a new clang-tidy check (still on-going).
      
      Reviewers: rsmith, aaron.ballman
      
      Subscribers: cfe-commits
      
      Differential Revision: http://reviews.llvm.org/D20773
      
      git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@271431 91177308-0d34-0410-b5e6-96231b3b80d8
      06caa0fe
  3. Mar 23, 2016
  4. Mar 09, 2016
  5. Aug 13, 2015
  6. Jul 29, 2015
  7. Jun 23, 2015
  8. Jun 22, 2015
  9. May 17, 2015
  10. Dec 18, 2014
  11. May 28, 2014
  12. May 26, 2014
  13. Mar 13, 2014
  14. Mar 07, 2014
  15. Feb 08, 2014
    • Reid Kleckner's avatar
      Move the -fms-compatibility using decl check after real access checking · da8b957a
      Reid Kleckner authored
      Summary:
      This avoids false positives from -Wmicrosoft when name lookup would
      normally succeed in standard C++.  This triggered on a common CRTP
      pattern in clang, where a derived class would have a private using decl
      to pull in members of a dependent base:
      
      class Verifier : InstVisitor<Verifier> {
      private:
        using InstVisitor<Verifier>::visit;
        ...
        void anything() {
          visit(); // warned here
        }
      };
      
      Real access checks pass here because we're in the context of the
      Verifier, but the -Wmicrosoft extension was just looking for the private
      access specifier.
      
      Reviewers: rsmith
      
      CC: cfe-commits
      
      Differential Revision: http://llvm-reviews.chandlerc.com/D2679
      
      git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201019 91177308-0d34-0410-b5e6-96231b3b80d8
      da8b957a
  16. Jan 25, 2014
  17. Jan 22, 2014
  18. Jan 20, 2014
    • Alp Toker's avatar
      Rename FunctionProtoType accessors from 'arguments' to 'parameters' · c50bf3d1
      Alp Toker authored
      Fix a perennial source of confusion in the clang type system: Declarations and
      function prototypes have parameters to which arguments are supplied, so calling
      these 'arguments' was a stretch even in C mode, let alone C++ where default
      arguments, templates and overloading make the distinction important to get
      right.
      
      Readability win across the board, especially in the casting, ADL and
      overloading implementations which make a lot more sense at a glance now.
      
      Will keep an eye on the builders and update dependent projects shortly.
      
      No functional change.
      
      git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199686 91177308-0d34-0410-b5e6-96231b3b80d8
      c50bf3d1
  19. Jan 14, 2014
    • Alp Toker's avatar
      Rename language option MicrosoftMode to MSVCCompat · ab3d5959
      Alp Toker authored
      There's been long-standing confusion over the role of these two options. This
      commit makes the necessary changes to differentiate them clearly, following up
      from r198936.
      
      MicrosoftExt (aka. fms-extensions):
       Enable largely unobjectionable Microsoft language extensions to ease
       portability. This mode, also supported by gcc, is used for building software
       like FreeBSD and Linux kernel extensions that share code with Windows drivers.
      
      MSVCCompat (aka. -fms-compatibility, formerly MicrosoftMode):
       Turn on a special mode supporting 'heinous' extensions for drop-in
       compatibility with the Microsoft Visual C++ product. Standards-compilant C and
       C++ code isn't guaranteed to work in this mode. Implies MicrosoftExt.
      
      Note that full -fms-compatibility mode is currently enabled by default on the
      Windows target, which may need tuning to serve as a reasonable default.
      
      See cfe-commits for the full discourse, thread 'r198497 - Move MS predefined
      type_info out of InitializePredefinedMacros'
      
      No change in behaviour.
      
      git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199209 91177308-0d34-0410-b5e6-96231b3b80d8
      ab3d5959
  20. Dec 11, 2013
  21. Dec 05, 2013
    • Faisal Vali's avatar
      Fix init-captures for generic lambdas. · cedc8af4
      Faisal Vali authored
      For an init capture, process the initialization expression
      right away.  For lambda init-captures such as the following:
      const int x = 10;
       auto L = [i = x+1](int a) {
         return [j = x+2,
                &k = x](char b) { };
       };
      keep in mind that each lambda init-capture has to have:
       - its initialization expression executed in the context
         of the enclosing/parent decl-context.
       - but the variable itself has to be 'injected' into the
         decl-context of its lambda's call-operator (which has
         not yet been created).
      Each init-expression is a full-expression that has to get
      Sema-analyzed (for capturing etc.) before its lambda's
      call-operator's decl-context, scope & scopeinfo are pushed on their
      respective stacks.  Thus if any variable is odr-used in the init-capture
      it will correctly get captured in the enclosing lambda, if one exists.
      The init-variables above are created later once the lambdascope and
      call-operators decl-context is pushed onto its respective stack.
      
      Since the lambda init-capture's initializer expression occurs in the
      context of the enclosing function or lambda, therefore we can not wait
      till a lambda scope has been pushed on before deciding whether the
      variable needs to be captured.  We also need to process all
      lvalue-to-rvalue conversions and discarded-value conversions,
      so that we can avoid capturing certain constant variables.
      For e.g.,
       void test() {
        const int x = 10;
        auto L = [&z = x](char a) { <-- don't capture by the current lambda
          return [y = x](int i) { <-- don't capture by enclosing lambda
               return y;
          }
        };
      If x was not const, the second use would require 'L' to capture, and
      that would be an error.
      Make sure TranformLambdaExpr is also aware of this.
      
      Patch approved by Richard (Thanks!!) 
      http://llvm-reviews.chandlerc.com/D2092
      
      git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@196454 91177308-0d34-0410-b5e6-96231b3b80d8
      cedc8af4
  22. Oct 01, 2013
  23. Sep 26, 2013
    • Kaelyn Uhrain's avatar
      Teach typo correction to look inside of classes like it does namespaces. · 3d9559b9
      Kaelyn Uhrain authored
      Unlike with namespaces, searching inside of classes requires also
      checking the access to correction candidates (i.e. don't suggest a
      correction to a private class member for a correction occurring outside
      that class and its methods or friends).
      
      Included is a small (one line) fix for a bug, that was uncovered while
      cleaning up the unit tests, where the decls from a TypoCorrection candidate
      were preserved in new TypoCorrection candidates that are derived (copied)
      from the old TypoCorrection--notably when creating a new candidate by
      changing the NestedNameSpecifier associated with the base idenitifer.
      
      git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191449 91177308-0d34-0410-b5e6-96231b3b80d8
      3d9559b9
  24. Sep 20, 2013
    • Richard Smith's avatar
      Switch the semantic DeclContext for a block-scope declaration of a function or · a41c97a5
      Richard Smith authored
      variable from being the function to being the enclosing namespace scope (in
      C++) or the TU (in C). This allows us to fix a selection of related issues
      where we would build incorrect redeclaration chains for such declarations, and
      fail to notice type mismatches.
      
      Such declarations are put into a new IdentifierNamespace, IDNS_LocalExtern,
      which is only found when searching scopes, and not found when searching
      DeclContexts. Such a declaration is only made visible in its DeclContext if
      there are no non-LocalExtern declarations.
      
      
      git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191064 91177308-0d34-0410-b5e6-96231b3b80d8
      a41c97a5
  25. Aug 23, 2013
  26. Jul 19, 2013
  27. May 07, 2013
  28. Apr 29, 2013
  29. Feb 27, 2013
  30. Feb 22, 2013
    • John McCall's avatar
      Only suppress instance context if a member is actually · 637619b9
      John McCall authored
      accessible in its declaring class;  otherwise we might
      fail to apply [class.protected] when considering
      accessibility in derived classes.
      
      Noticed by inspection; <rdar://13270329>.
      
      I had an existing test wrong.  Here's why it's wrong:
      
      Follow the rules (and notation) of [class.access]p5.
      The naming class (N) is B and the context (R) is D::getX.
      - 'x' as a member of B is protected, but R does not occur
        in a member or friend of a class derived from B.
      - There does exist a base class of B, A, which is accessible
        from R, and 'x' is accessible at R when named in A because
        'x' as a member of A is protected and R occurs in a member
        of a class, D, that is derived from A;  however, by
        [class.protected], the class of the object expression must
        be equal to or derived from that class, and A does not
        derive from D.
      
      git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175858 91177308-0d34-0410-b5e6-96231b3b80d8
      637619b9
  31. Dec 04, 2012
  32. Sep 27, 2012
  33. Aug 25, 2012
  34. Aug 24, 2012
  35. Aug 10, 2012
    • John McCall's avatar
      Check access to friend declarations. There's a number of different · 1f2e1a96
      John McCall authored
      things going on here that were problematic:
        - We were missing the actual access check, or rather, it was suppressed
          on account of being a redeclaration lookup.
        - The access check would naturally happen during delay, which isn't
          appropriate in this case.
        - We weren't actually emitting dependent diagnostics associated with
          class templates, which was unfortunate.
        - Access was being propagated incorrectly for friend method declarations
          that couldn't be matched at parse-time.
      
      git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161652 91177308-0d34-0410-b5e6-96231b3b80d8
      1f2e1a96
  36. Jul 04, 2012
  37. Jun 22, 2012
Loading