summaryrefslogtreecommitdiffstats
path: root/test/CodeGenCXX/thunks.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Complain about attempts to use 'protected' visibility on targetsJohn McCall2012-01-291-2/+2
| | | | | | | | like Darwin that don't support it. We should also complain about invalid -fvisibility=protected, but that information doesn't seem to exist at the most appropriate time, so I've left a FIXME behind. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149186 91177308-0d34-0410-b5e6-96231b3b80d8
* Add an implementation of thunks for varargs methods. The implementation is ↵Eli Friedman2011-05-061-3/+27
| | | | | | a bit messy, but it is correct as long as the method in question doesn't use indirect gotos. A couple of possible alternative implementations are outlined in FIXME's in this patch. rdar://problem/8077308 . git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130993 91177308-0d34-0410-b5e6-96231b3b80d8
* Warn about code that uses variables and functions with internal linkageJohn McCall2011-02-191-23/+21
| | | | | | | | | | | | | | | | without defining them. This should be an error, but I'm paranoid about "uses" that end up not actually requiring a definition. I'll revisit later. Also, teach IR generation to not set internal linkage on variable declarations, just for safety's sake. Doing so produces an invalid module if the variable is not ultimately defined. Also, fix several places in the test suite where we were using internal functions without definitions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126016 91177308-0d34-0410-b5e6-96231b3b80d8
* When re-using a vtable slot for the nearest overridden method, just becauseJohn McCall2010-11-091-0/+19
| | | | | | | | | | | | | | there's no return adjustment from the overridden to the overrider doesn't mean there isn't a return adjustment from the overrider to the final overrider. This matters if we're emitting a virtual this-adjustment thunk because the overrider virtually inherits from the class providing the nearest overridden method. Do the appropriate return adjustment in this case. Fixes PR7611. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118466 91177308-0d34-0410-b5e6-96231b3b80d8
* Just disable the hidden-visibility optimization for now by hiding it behindJohn McCall2010-08-121-3/+4
| | | | | | | | | | a -cc1 option. The Darwin linker complains about mixed visibility when linking gcc-built objects with clang-built objects, and the optimization isn't really that valuable. Platforms with less ornery linkers can feel free to enable this. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110979 91177308-0d34-0410-b5e6-96231b3b80d8
* Extend the visibility-hidden optimization to linkonce_odr thunks forJohn McCall2010-08-041-1/+14
| | | | | | | | | | | functions with in-line definitions, since such thunks will be emitted at any use of the function. Completes the feature work for rdar://problem/7523229. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110285 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't try to emit the vtable for a class just because we're emitting aJohn McCall2010-06-021-0/+12
| | | | | | | | | | virtual function from it. Fixes PR7241. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105345 91177308-0d34-0410-b5e6-96231b3b80d8
* Correctly pass aggregates by reference when emitting thunks.John McCall2010-05-261-0/+18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104778 91177308-0d34-0410-b5e6-96231b3b80d8
* When generating the call arguments in a thunk to call the thunkee, doDouglas Gregor2010-05-211-0/+45
| | | | | | | | | not make copies non-POD arguments or arguments passed by reference: just copy the pointers directly. This eliminates another source of the dreaded memcpy-of-non-PODs. Fixes PR7188. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104327 91177308-0d34-0410-b5e6-96231b3b80d8
* When creating a this-adjustment thunk where the return value is of C++Douglas Gregor2010-05-201-4/+45
| | | | | | | | | | class type (that uses a return slot), pass the return slot to the callee directly rather than allocating new storage and trying to copy the object. This appears to have been the cause of the remaining two Boost.Interprocess failures. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104215 91177308-0d34-0410-b5e6-96231b3b80d8
* Rework when and how vtables are emitted, by tracking where vtables areDouglas Gregor2010-05-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "used" (e.g., we will refer to the vtable in the generated code) and when they are defined (i.e., because we've seen the key function definition). Previously, we were effectively tracking "potential definitions" rather than uses, so we were a bit too eager about emitting vtables for classes without key functions. The new scheme: - For every use of a vtable, Sema calls MarkVTableUsed() to indicate the use. For example, this occurs when calling a virtual member function of the class, defining a constructor of that class type, dynamic_cast'ing from that type to a derived class, casting to/through a virtual base class, etc. - For every definition of a vtable, Sema calls MarkVTableUsed() to indicate the definition. This happens at the end of the translation unit for classes whose key function has been defined (so we can delay computation of the key function; see PR6564), and will also occur with explicit template instantiation definitions. - For every vtable defined/used, we mark all of the virtual member functions of that vtable as defined/used, unless we know that the key function is in another translation unit. This instantiates virtual member functions when needed. - At the end of the translation unit, Sema tells CodeGen (via the ASTConsumer) which vtables must be defined (CodeGen will define them) and which may be used (for which CodeGen will define the vtables lazily). From a language perspective, both the old and the new schemes are permissible: we're allowed to instantiate virtual member functions whenever we want per the standard. However, all other C++ compilers were more lazy than we were, and our eagerness was both a performance issue (we instantiated too much) and a portability problem (we broke Boost test cases, which now pass). Notes: (1) There's a ton of churn in the tests, because the order in which vtables get emitted to IR has changed. I've tried to isolate some of the larger tests from these issues. (2) Some diagnostics related to implicitly-instantiated/implicitly-defined virtual member functions have moved to the point of first use/definition. It's better this way. (3) I could use a review of the places where we MarkVTableUsed, to see if I missed any place where the language effectively requires a vtable. Fixes PR7114 and PR6564. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103718 91177308-0d34-0410-b5e6-96231b3b80d8
* Give thunks the same linkage as their original methods.Anders Carlsson2010-03-271-4/+25
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99729 91177308-0d34-0410-b5e6-96231b3b80d8
* Flip the switch and use the new vtable layout code for thunks by default. ↵Anders Carlsson2010-03-241-0/+116
Add a thunks.cpp test. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99367 91177308-0d34-0410-b5e6-96231b3b80d8