Commit Graph

517 Commits

Author SHA1 Message Date
Eli Friedman 5866fe306d Fix for PR5967: Make const-marking for LLVM globals correct for cases requiring
run-time initialization, and emit run-time initializers aggresively to avoid
ordering issues with deferred globals.

llvm-svn: 92976
2010-01-08 00:50:11 +00:00
Nuno Lopes 950d5b2cd3 fix PR5869: mangle static symbols like gcc does to make it easier to diff symbol tables
llvm-svn: 92911
2010-01-07 09:36:51 +00:00
Douglas Gregor 3a08dcc156 Test linkage of typeinfo and typeinfo names for class templates
llvm-svn: 92897
2010-01-07 04:09:30 +00:00
Douglas Gregor d01472beee Revert my available_externally vtables experiment. It's breaking the LLVM-with-Clang build with linker errors that I have yet to investigate.
llvm-svn: 92822
2010-01-06 04:50:56 +00:00
Douglas Gregor 1a68ab6c83 Make use of available_externally linkage for vtables when the
non-inline key function of a class template instantiation, when no key
function is present, the class template instantiation itself was
instantiated with an explicit instantiation declaration (aka extern
template). I'm fairly certain that the C++0x specification gives us
this lattitude, although GCC doesn't take advantage of it.

llvm-svn: 92779
2010-01-05 21:40:05 +00:00
Douglas Gregor a318efd1f2 Improve key-function computation for templates. In particular:
- All classes can have a key function; templates don't change that.
  non-template classes when computing the key function.
  - We always mark all of the virtual member functions of class
  template instantiations. 
  - The vtable for an instantiation of a class template has weak
  linkage. 

We could probably use available_externally linkage for vtables of
classes instantiated by explicit instantiation declarations (extern
templates), but GCC doesn't do this and I'm not 100% that the ABI
permits it.

llvm-svn: 92753
2010-01-05 19:06:31 +00:00
Anders Carlsson a0b025e40f When emitting member function pointers, use the canonical decl if the member function is virtual. Fixes PR5940.
llvm-svn: 92680
2010-01-05 05:04:05 +00:00
Eli Friedman 50f6aa11cf Improve coverage for test.
llvm-svn: 92440
2010-01-03 01:20:41 +00:00
Anders Carlsson e36a6b3e44 Correctly pass VTT parameters to constructors and destructors. The VTTs aren't yet used in the ctors/dtors, but that will follow.
llvm-svn: 92409
2010-01-02 01:01:18 +00:00
Anders Carlsson 2d21394190 If the key function of a record is inline, then the RTTI data should have weak_odr linkage.
llvm-svn: 92371
2009-12-31 19:36:25 +00:00
Anders Carlsson bc7def9850 Remove rtti.cpp, it's very fragile and has been marked XFAIL for a while now. Between rtti-layout.cpp and rtti-linkage.cpp, RTTI testing should be covered.
llvm-svn: 92361
2009-12-31 17:44:32 +00:00
Anders Carlsson a442499072 Fix a bunch of bugs with VMI RTTI building, and add a whole bunch of tests.
llvm-svn: 92319
2009-12-30 23:47:56 +00:00
Anders Carlsson 1e4cd33f13 Add base class checks.
llvm-svn: 92286
2009-12-30 01:29:05 +00:00
Anders Carlsson a4bbe58c3b Add more vtable tests.
llvm-svn: 92285
2009-12-30 01:25:42 +00:00
Anders Carlsson ac2f681777 More RTTI cleanup, test that RTTI classes have the correct vtables.
llvm-svn: 92284
2009-12-30 01:00:12 +00:00
Anders Carlsson ef88695860 Handle enum types as well.
llvm-svn: 92276
2009-12-29 22:13:01 +00:00
Anders Carlsson 26cf4ab8e2 Fix function type RTTI linkage and add tests.
llvm-svn: 92266
2009-12-29 20:20:19 +00:00
Sam Weinig b999f68ed9 Fix for PR5871. Make __PRETTY_FUNCTION__ work for member functions defined in a class local to a function.
llvm-svn: 92200
2009-12-28 03:19:38 +00:00
Eli Friedman e513c6af97 Fix runline.
llvm-svn: 92174
2009-12-27 05:59:41 +00:00
Eli Friedman 847a2bce04 Fix PointerExprEvaluator::VisitCastExpr so it doesn't misfold C++ casts which
it doesn't know how to fold, like derived-to-base casts.

llvm-svn: 92173
2009-12-27 05:43:15 +00:00
Sam Weinig 4e83bd2795 Fix for PR5872. Add static specifier and const/volatile qualifiers to member functions in __PRETTY_FUNCTION__ predefined expressions.
llvm-svn: 92171
2009-12-27 01:38:20 +00:00
Eli Friedman fddc26cc64 Make copy constructor elimination work in more cases; the case in question
here affects clang-on-clang.

llvm-svn: 92151
2009-12-24 23:33:34 +00:00
Sam Weinig 07d211ea40 Fix for PR5844. Be explicit about anonymous struct/class/union/namespaces in __PRETTY_FUNCTION__ predefined expression.
llvm-svn: 92149
2009-12-24 23:15:03 +00:00
Douglas Gregor 363b151ff7 When transforming CXXExprWithTemporaries and CXXBindTemporaryExpr
expressions (e.g., for template instantiation), just transform the
subexpressions and return those, since the temporary-related nodes
will be implicitly regenerated. Fixes PR5867, but I said that
before...

llvm-svn: 92135
2009-12-24 18:51:59 +00:00
Douglas Gregor f82bead3fd InitializationSequence handles binding to temporaries, so that
argument-passing doesn't have to. Fixes PR5867, where we were binding
a temporary twice in the AST and, therefore, calling its destructor
twice.

llvm-svn: 92131
2009-12-24 17:16:46 +00:00
Anders Carlsson a88d197284 Mangle block pointer types. Fixes PR5858.
llvm-svn: 92069
2009-12-23 22:31:44 +00:00
Douglas Gregor 247894b361 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.

llvm-svn: 92064
2009-12-23 22:04:40 +00:00
Douglas Gregor f45f6828c6 Remove cv-qualifiers from the argument to typeid
llvm-svn: 92041
2009-12-23 20:51:04 +00:00
Anders Carlsson 910847c149 Mangle template template parameters. Fixes PR5861.
llvm-svn: 92030
2009-12-23 19:30:55 +00:00
Douglas Gregor 19fc0b753a Make sure that reinterpret_cast gets a CastKind on all successful
paths. Fixes "cannot compile this unexpected cast lvalue yet" error in
llvm/lib/Analysis/IPA/GlobalsModRef.cpp.

llvm-svn: 91932
2009-12-22 22:47:22 +00:00
Anders Carlsson 8a35c7982c Make sure that we mangle overloaded operators that are member functions correctly, giving them the correct arity.
With this seemingly insignificant fix, we are now able to build and link clang using clang itself! (LLVM still has to be built with gcc for the time being).

llvm-svn: 91893
2009-12-22 06:36:32 +00:00
Daniel Dunbar 3780f0b680 x86_64: Structures with no fields but which have padding should be classified as
integer.
 - This is consistent, but may not be correct. I will revisit x86_64 ABI handling for C++ as a whole at some point.
 - PR5831.

llvm-svn: 91874
2009-12-22 01:19:25 +00:00
Douglas Gregor 4141d5bea2 When converting from a type to itself or one of its base classes via a
constructor call, the conversion is only a standard conversion
sequence if that constructor is a copy constructor. This fixes PR5834
in a semi-lame way, because the "real" fix will be to move over to
InitializationSequence. That will happen "soonish", but not now.

llvm-svn: 91861
2009-12-22 00:21:20 +00:00
Anders Carlsson 9a98ac993f Add tests for structs inside anonymous namespaces.
llvm-svn: 91806
2009-12-21 00:57:38 +00:00
Anders Carlsson 2b7f444366 Incomplete structs should also have internal linkage.
llvm-svn: 91805
2009-12-21 00:41:42 +00:00
Anders Carlsson 18e6ee1b20 Correcly handle pointers to member pointer types where the class or the pointee is incomplete.
llvm-svn: 91804
2009-12-20 23:37:55 +00:00
Anders Carlsson d008129f34 Rework the way pointer types are handled by the RTTI builder. We now get the right linkage for indirect pointers to incomplete structs.
llvm-svn: 91799
2009-12-20 22:30:54 +00:00
Douglas Gregor a4b592a7d5 Switch more of Sema::CheckInitializerTypes over to
InitializationSequence. Specially, switch initialization of a C++
class type (either copy- or direct-initialization). 

Also, make sure that we create an elidable copy-construction when
performing copy initialization of a C++ class variable. Fixes PR5826.

llvm-svn: 91750
2009-12-19 03:01:41 +00:00
Anders Carlsson 6fda43f4c1 Correctly initialize the PrimaryBaseInfo if a base is null. Fixes PR5832.
llvm-svn: 91748
2009-12-19 02:13:41 +00:00
Eli Friedman 357e8c94d6 Fix for PR5524: make reference binding in default argument work correctly.
llvm-svn: 91733
2009-12-19 00:20:10 +00:00
Eli Friedman 726b878574 Test for r91724.
llvm-svn: 91730
2009-12-18 23:42:55 +00:00
Anders Carlsson 0087bc851c Fix regression I introduced when dynamic_cast-ing to a reference type.
llvm-svn: 91687
2009-12-18 14:55:04 +00:00
Anders Carlsson b396f43520 It's perfectly fine to see UserDefinedConversion casts when emitting scalar expressions.
llvm-svn: 91686
2009-12-18 14:42:03 +00:00
Douglas Gregor e1314a64b8 Switch the initialization required by return statements over to the
new InitializationSequence. This fixes some bugs (e.g., PR5808),
changed some diagnostics, and caused more churn than expected. What's
new:

  - InitializationSequence now has a "C conversion sequence" category
    and step kind, which falls back to
  - Changed the diagnostics for returns to always have the result type
    of the function first and the type of the expression second.
    CheckSingleAssignmentConstraints to peform checking in C. 
  - Improved ASTs for initialization of return values. The ASTs now
    capture all of the temporaries we need to create, but
    intentionally do not bind the tempoary that is actually returned,
    so that it won't get destroyed twice.
  - Make sure to perform an (elidable!) copy of the class object that
    is returned from a class.
  - Fix copy elision in CodeGen to properly see through the
    subexpressions that occur with elidable copies.
  - Give "new" its own entity kind; as with return values and thrown
    objects, we don't bind the expression so we don't call a
    destructor for it.

Note that, with this patch, I've broken returning move-only types in
C++0x. We'll fix it later, when we tackle NRVO.

llvm-svn: 91669
2009-12-18 05:02:21 +00:00
Sean Callanan 12ca3f46d8 Testcase fixes to reflect instruction table changes in the LLVM backend
(http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20091214/092780.html)
The instruction fixes were checked and approved by Chris Lattner, but
these testcase fixes are mine; please yell at me if there are any
problems with either.

* PR5050-constructor-conversion.cpp
* array-construction.cpp
* constructor-conversion.cpp
* cast-conversion.cpp
* constructor-default-arg.cpp
* derived-to-base-conv.cpp
* ptr-to-member-function.cpp
* call-arg-zero-temp.cpp
* default-destructor-synthesis.cpp
* global-array-destruction.cpp
* array-operator-delete-call.cpp
* decl-ref-init.cpp
* default-constructor-for-members.cpp
* convert-to-fptr.cpp
* constructor-for-array-members.cpp
* conversion-function.cpp
* objc-read-weak-byref.m
	Fixed testcase to reflect call qualifier

llvm-svn: 91640
2009-12-18 00:04:09 +00:00
Nuno Lopes 641fdce235 revert part of my last patch, and mark only the c++ global new operator as noalias. the rest will be infered by llvm optz
llvm-svn: 91600
2009-12-17 10:15:49 +00:00
Anders Carlsson 539e584c3c Attempt to fix rtti-layout.cpp on Linux.
llvm-svn: 91581
2009-12-17 04:57:25 +00:00
Anders Carlsson dc9b9cf7b1 Add a (currently failing) RTTI layout test.
llvm-svn: 91580
2009-12-17 04:41:05 +00:00
Douglas Gregor 8cdc2e0590 Fix test case to unbreak testing
llvm-svn: 91551
2009-12-16 19:18:40 +00:00
Douglas Gregor 4f4b186215 When value-initializing a class with no user-defined constructors but
with a non-trivial default constructor, zero-initialize the storage
and then call the default constructor. Fixes PR5800.

llvm-svn: 91548
2009-12-16 18:50:27 +00:00