Граф коммитов

174 Коммитов

Автор SHA1 Сообщение Дата
Anders Carlsson 51591bed10 Fix another pointer-to-member function miscompile, this time when trying to call a virtual member function.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95307 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-04 17:08:48 +00:00
Douglas Gregor 321725d95d Provide a real fix for PR6199, reverting the old workaround. Here, we
realize that CXXConstructExpr is always implicit, so we should just
return its argument (if there is only one) rather than directly
invoking the constructor.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95192 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-03 03:01:57 +00:00
Anders Carlsson 2e13db8bc6 Check in a test case and a nasty workaround for PR6199.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95076 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-02 07:10:35 +00:00
Eli Friedman 6997aae428 Switch expressions like T() and T(1,2) over to new-style initialization. I'm
not quite sure what we want to do about the AST representation; comments
welcome.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94967 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-31 20:58:15 +00:00
Douglas Gregor 9db7dbb918 Rework base and member initialization in constructors, with several
(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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94952 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-31 09:12:51 +00:00
Ken Dyck 4f122ef0ca Convert one last size variable to CharUnits (follow-on to 94577).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94579 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-26 19:59:28 +00:00
Ken Dyck caf647c33a Use CharUnits for sizes, offsets, alignments, and padding amounts for values
that are in character units.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94577 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-26 19:44:24 +00:00
Anders Carlsson c997d4278d Correctly pass VTT parameters to constructors and destructors. The VTTs aren't yet used in the ctors/dtors, but that will follow.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92409 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-02 01:01:18 +00:00
Anders Carlsson 3b5ad2283c Move a few more functions away from CGCXX and to CGClass and CGExprCXX.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92399 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-01 20:29:01 +00:00
Benjamin Kramer 54d76db0aa Remove some dead variables clang-analyzer found.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92162 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-25 15:43:36 +00:00
Anders Carlsson a1736c0c75 Pass the return value slot to all call exprs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92145 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-24 21:13:40 +00:00
Anders Carlsson f3c47c9525 Pass ReturnValueSlot to EmitCall. No functionality change yet.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92138 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-24 19:25:24 +00:00
Douglas Gregor 154fe9812f There is no such thing as typeinfo for a cv-qualified type. Assert
that this is true when mangling, then fix up the various places in
Sema and/or CodeGen that need to remove qualifiers. Addresses a
linking issue when building LLVM with Clang.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92064 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-23 22:04:40 +00:00
Anders Carlsson 6f0e485a5c Fix regression I introduced when dynamic_cast-ing to a reference type.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91687 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-18 14:55:04 +00:00
Anders Carlsson 1d7088d1d9 Rename GetAddrOfRTTI to GetAddrOfRTTIDescriptor. Remove the overload that takes a CXXRecordDecl since we were just creating a QualType from it anyway.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91590 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-17 07:09:17 +00:00
Anders Carlsson e8e4a1c0bf Use GetAddrOfRTTI everywhere and remove GenerateRTTI and GenerateRTTIRef. With this change, we can now compile and link TableGen.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91520 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-16 07:05:41 +00:00
Anders Carlsson dd9375513d Don't use a cookie if the global placement new function is used.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91251 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-13 20:34:34 +00:00
Anders Carlsson 710f705840 Fix regression in my last commit - if a struct has a trivial destructor but no usual deallocation function we don't need a cookie.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91249 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-13 20:10:12 +00:00
Anders Carlsson 871d078f5a More array cookie improvements.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91247 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-13 20:04:38 +00:00
Anders Carlsson 6153710ee3 If the usual array deallocation function of a class takes two arguments, we need to pass the number of bytes allocated to the deallocation function, just not the number of bytes in a single element.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91246 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-13 18:48:07 +00:00
Anders Carlsson 31b7f52d8c Improve linkage of RTTI data structures. Introduce CodeGenModule::GetAddrOfRTTI which figures out the right linkage of the RTTI information for the given type and whether it should be defined or not. I will migrate clients over to GetAddrOfRTTI in subsequent commits (with tests).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91098 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-11 02:46:30 +00:00
Mike Stump de05057932 Change rtti/Rtti to RTTI, as it is an acronym.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90334 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-02 18:57:08 +00:00
Anders Carlsson 5d4d946ec2 Handle cases where we're constructing an array of objects and the constructor has default arguments.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89783 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-24 18:43:52 +00:00
Anders Carlsson 5b955920c1 Get rid of the ugly CGCXX names and replace them with CGClass, CGExprCXX and CGTemporaries.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89742 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-24 05:51:11 +00:00