Skip to content
  1. Feb 03, 2010
    • Douglas Gregor's avatar
      When a function or variable somehow depends on a type or declaration · 7dc5c17d
      Douglas Gregor authored
      that is in an anonymous namespace, give that function or variable
      internal linkage.
      
      This change models an oddity of the C++ standard, where names declared
      in an anonymous namespace have external linkage but, because anonymous
      namespace are really "uniquely-named" namespaces, the names cannot be
      referenced from other translation units. That means that they have
      external linkage for semantic analysis, but the only sensible
      implementation for code generation is to give them internal
      linkage. We now model this notion via the UniqueExternalLinkage
      linkage type. There are several changes here:
      
        - Extended NamedDecl::getLinkage() to produce UniqueExternalLinkage
          when the declaration is in an anonymous namespace.
        - Added Type::getLinkage() to determine the linkage of a type, which
          is defined as the minimum linkage of the types (when we're dealing
          with a compound type that is not a struct/class/union).
        - Extended NamedDecl::getLinkage() to consider the linkage of the
          template arguments and template parameters of function template
          specializations and class template specializations.
        - Taught code generation to rely on NamedDecl::getLinkage() when
          determining the linkage of variables and functions, also
          considering the linkage of the types of those variables and
          functions (C++ only). Map UniqueExternalLinkage to internal
          linkage, taking out the explicit checks for
          isInAnonymousNamespace().
      
      This fixes much of PR5792, which, as discovered by Anders Carlsson, is
      actually the reason behind the pass-manager assertion that causes the
      majority of clang-on-clang regression test failures. With this fix,
      Clang-built-Clang+LLVM passes 88% of its regression tests (up from
      67%). The specific numbers are:
      
      LLVM:
        Expected Passes    : 4006
        Expected Failures  : 32
        Unsupported Tests  : 40
        Unexpected Failures: 736
      
      Clang:
        Expected Passes    : 1903
        Expected Failures  : 14
        Unexpected Failures: 75
      
      Overall:
        Expected Passes    : 5909
        Expected Failures  : 46
        Unsupported Tests  : 40
        Unexpected Failures: 811
      
      Still to do:
        - Improve testing
        - Check whether we should allow the presence of types with
        InternalLinkage (in addition to UniqueExternalLinkage) given
        variables/functions internal linkage in C++, as mentioned in
        PR5792. 
        - Determine how expensive the getLinkage() calls are in practice;
        consider caching the result in NamedDecl.
        - Assess the feasibility of Chris's idea in comment #1 of PR5792.
      
      llvm-svn: 95216
      7dc5c17d
    • Chris Lattner's avatar
      remove a big chunk of #if 0 code. · eb1e610d
      Chris Lattner authored
      llvm-svn: 95201
      eb1e610d
    • Douglas Gregor's avatar
      Provide a real fix for PR6199, reverting the old workaround. Here, we · db56b919
      Douglas Gregor authored
      realize that CXXConstructExpr is always implicit, so we should just
      return its argument (if there is only one) rather than directly
      invoking the constructor.
      
      llvm-svn: 95192
      db56b919
    • David Chisnall's avatar
      Numerous changes to selector handling: · 92b762e2
      David Chisnall authored
      - Don't use GlobalAliases with non-0 GEPs (GNU runtime) - this was unsupported and LLVM will be generating errors if you do it soon.  This also simplifies the code generated by the GNU runtime a bit.  
      
      - Make GetSelector() return a constant (GNU runtime), not a load of a store of a constant.
      
      - Recognise @selector() expressions as valid static initialisers (as GCC does).
      
      - Add methods to GCObjCRuntime to emit selectors as constants (needed for using @selector() expressions as constants.  These need implementing for the Mac runtimes - I couldn't figure out how to do this, they seem to require a load.
      
      - Store an ObjCMethodDecl in an ObjCSelectorExpr so that we can get at the type information for the selector.  This is needed for generating typed selectors from @selector() expressions (as GCC does).  Ideally, this information should be stored in the Selector, but that would be an invasive change.  We should eventually add checks for common uses of @selector() expressions.  Possibly adding an attribute that can be applied to method args providing the types of a selector so, for example, you'd do something like this:
      
      - (id)performSelector: __attribute__((selector_types(id, SEL, id)))(SEL)
                 withObject: (id)object;
      
      Then, any @selector() expressions passed to the method will be check to ensure that it conforms to this signature.  We do this at run time on the GNU runtime already, but it would be nice to do it at compile time on all runtimes.
      
      - Made @selector() expressions emit type info if available and the runtime supports it.
      
      Someone more familiar with the Mac runtime needs to implement the GetConstantSelector() function in CGObjCMac.  This currently just assert()s.
      
      llvm-svn: 95189
      92b762e2
    • John McCall's avatar
      Remove abstract expression kinds from the StmtClass enum. Update a few users · 2adddcae
      John McCall authored
      appropriately.  Call out a few missing cases in the expression mangler.
      
      llvm-svn: 95176
      2adddcae
  2. Feb 02, 2010
  3. Feb 01, 2010
  4. Jan 31, 2010
    • Eli Friedman's avatar
      Switch expressions like T() and T(1,2) over to new-style initialization. I'm · a682427e
      Eli Friedman authored
      not quite sure what we want to do about the AST representation; comments
      welcome.
      
      llvm-svn: 94967
      a682427e
    • Eli Friedman's avatar
      Simplify EmitMemberInitializer; no intended functionality change. · 60417977
      Eli Friedman authored
      llvm-svn: 94965
      60417977
    • Anders Carlsson's avatar
    • Douglas Gregor's avatar
      Rework base and member initialization in constructors, with several · 7ae2d775
      Douglas Gregor authored
      (necessarily simultaneous) changes:
      
        - CXXBaseOrMemberInitializer now contains only a single initializer
          rather than a set of initialiation arguments + a constructor. The
          single initializer covers all aspects of initialization, including
          constructor calls as necessary but also cleanup of temporaries
          created by the initializer (which we never handled
          before!).
      
        - Rework + simplify code generation for CXXBaseOrMemberInitializers,
          since we can now just emit the initializer as an initializer.
      
        - Switched base and member initialization over to the new
          initialization code (InitializationSequence), so that it
      
        - Improved diagnostics for the new initialization code when
          initializing bases and members, to match the diagnostics produced
          by the previous (special-purpose) code.
      
        - Simplify the representation of type-checked constructor initializers in
          templates; instead of keeping the fully-type-checked AST, which is
          rather hard to undo at template instantiation time, throw away the
          type-checked AST and store the raw expressions in the AST. This
          simplifies instantiation, but loses a little but of information in
          the AST.
      
        - When type-checking implicit base or member initializers within a
          dependent context, don't add the generated initializers into the
          AST, because they'll look like they were explicit.
      
        - Record in CXXConstructExpr when the constructor call is to
        initialize a base class, so that CodeGen does not have to infer it
        from context. This ensures that we call the right kind of
        constructor.
      
      There are also a few "opportunity" fixes here that were needed to not
      regress, for example:
      
        - Diagnose default-initialization of a const-qualified class that
          does not have a user-declared default constructor. We had this
          diagnostic specifically for bases and members, but missed it for
          variables. That's fixed now.
      
        - When defining the implicit constructors, destructor, and
          copy-assignment operator, set the CurContext to that constructor
          when we're defining the body.
      
      llvm-svn: 94952
      7ae2d775
    • Anders Carlsson's avatar
      When performing a derived-to-base cast that we know will not change the... · 6276b250
      Anders Carlsson authored
      When performing a derived-to-base cast that we know will not change the offset, we don't need to null check the input pointer. Fixes PR5965.
      
      llvm-svn: 94942
      6276b250
    • Anders Carlsson's avatar
      When doing a base-to-derived cast we don't need to null check the derived... · 600f737b
      Anders Carlsson authored
      When doing a base-to-derived cast we don't need to null check the derived value if the class offset is 0.
      
      llvm-svn: 94939
      600f737b
    • Anders Carlsson's avatar
      Some class related cleanup. · 84673e20
      Anders Carlsson authored
      llvm-svn: 94938
      84673e20
  5. Jan 30, 2010
  6. Jan 29, 2010
Loading