summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX/vtable-layout.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix a few tests that were missing ':' on CHECK lines and weren't testing ↵Nico Weber2019-02-111-1/+1
| | | | | | | | | | | | anything. Found by `git grep '\/\/ CHECK-[^: ]* ' clang/test/ | grep -v RUN:`. Also tweak CodeGenCXX/arm-swiftcall.cpp to still pass now that it checks more. Differential Revision: https://reviews.llvm.org/D58061 llvm-svn: 353744
* Make two vtable tests tolerate C++11.Paul Robinson2016-12-201-0/+2
| | | | | | | | | In C++11 we don't emit vtables as eagerly as we do for C++03, so fiddle the tests to emit them when the test expects them. Differential Revision: http://reviews.llvm.org/D27994 llvm-svn: 290205
* Make -fdump-vtable-layouts print to stdout, not stderrReid Kleckner2013-11-081-1/+1
| | | | | | | | | | | | | This makes it consistent with -fdump-record-layouts, which was moved to outs() in r186219. My reasoning for going with stdout is that when one of these options is present, the layouts are really a program output, and shouldn't be interleaved with diagnostics, which are on stderr. Reviewers: timurrrr Differential Revision: http://llvm-reviews.chandlerc.com/D2127 llvm-svn: 194279
* ... and actually run itTimur Iskhodzhanov2013-06-051-0/+1
| | | | llvm-svn: 183309
* Add a test for the breakage from r183298Timur Iskhodzhanov2013-06-051-0/+34
| | | | llvm-svn: 183308
* Unrevert the tests from r183298 as they pass with both old and new codeTimur Iskhodzhanov2013-06-051-5/+146
| | | | llvm-svn: 183306
* Revert r183298 and r183300 as the former broke the virtual function lookup ↵Timur Iskhodzhanov2013-06-051-146/+5
| | | | | | in libcxx __locale llvm-svn: 183305
* Get rid of VTableContext::ComputeMethodVTableIndices() and ↵Timur Iskhodzhanov2013-06-051-5/+146
| | | | | | VTableContext::getNumVirtualFunctionPointers(); also add some tests for the VTable indices output to make sure we don't regress llvm-svn: 183298
* Note deleted functions when dumping vtables.David Blaikie2012-10-161-0/+21
| | | | llvm-svn: 166056
* For the annals of subtle but terrible bugs: fix a longstanding bugJohn McCall2012-03-211-0/+26
| | | | | | | | | | | | | | | | | | | | in vtable layout where virtual methods inherited from virtual bases could be assigned the same vcall adjustment slot if they shared a name and parameter signature but differed in their cv-qualification. The code was already trying to handle this case, but unfortunately used the ordinary type qualifiers (which are always empty here) instead of the method qualifiers. This seems like something that the API should discourage, but I don't know how to carry that principle out in this instance. Eliminate this function's need for an ASTContext while we're at it. This bug affects the ABI, and fixing it brings us into accord with the Itanium ABI (and GCC's implementation of it), but, obviously, technically breaks full compatibility with previous releases of Clang. Just letting you know. llvm-svn: 153168
* Change CollectPrimaryBases to collect the bases in the right order. Fixes ↵Anders Carlsson2011-04-101-0/+22
| | | | | | one half of PR9660. llvm-svn: 129252
* 'const std::type_info*' instead of 'std::type_info const*'Chris Lattner2010-09-051-1/+1
| | | | llvm-svn: 113092
* Rework when and how vtables are emitted, by tracking where vtables areDouglas Gregor2010-05-131-815/+857
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "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. llvm-svn: 103718
* Fix a bug where we would sometimes incorrectly mark an vtable function as ↵Anders Carlsson2010-04-171-0/+39
| | | | | | unused. llvm-svn: 101643
* Split adding the primary virtual base offsets out into a separate pass. This ↵Anders Carlsson2010-04-151-0/+87
| | | | | | fixes a bug where we would lay out virtual bases in the wrong order. llvm-svn: 101373
* Typo.Nick Lewycky2010-04-121-1/+1
| | | | llvm-svn: 101015
* Fix another bug where we wouldn't generate secondary vtables for ↵Anders Carlsson2010-04-111-0/+56
| | | | | | construction vtables in some cases. llvm-svn: 100998
* Fix a bug where we were adding too many vcall offsets in some cases.Anders Carlsson2010-04-111-0/+68
| | | | llvm-svn: 100985
* Fix another vbase layout bug.Anders Carlsson2010-04-101-0/+23
| | | | llvm-svn: 100952
* Fix a bug where we would add the same function twice in a vtable.Anders Carlsson2010-04-101-0/+38
| | | | llvm-svn: 100949
* Simplify the virtual base layout code and fix a bug where we wouldn't store ↵Anders Carlsson2010-04-101-0/+23
| | | | | | the offset for a virtual base. llvm-svn: 100940
* Another vtable layout fix, making us match gcc better.Anders Carlsson2010-03-291-0/+30
| | | | llvm-svn: 99812
* Don't add address points for virtual primary bases that aren't primary bases ↵Anders Carlsson2010-03-251-15/+4
| | | | | | in the complete class. llvm-svn: 99555
* When dumping vtables, also dump the thunks.Anders Carlsson2010-03-181-2/+2
| | | | llvm-svn: 98799
* Add a test.Anders Carlsson2010-03-111-0/+7
| | | | llvm-svn: 98246
* Fix calculation of whether a member function needs a thunk in construction ↵Anders Carlsson2010-03-101-0/+59
| | | | | | vtables. llvm-svn: 98191
* We were mistakenly marking morally virtual bases as being uninteresting. Fix ↵Anders Carlsson2010-03-101-0/+67
| | | | | | this. llvm-svn: 98180
* Ignore non-interesting bases when emitting construction vtables.Anders Carlsson2010-03-101-0/+60
| | | | llvm-svn: 98177
* Add newline.Anders Carlsson2010-03-101-2/+1
| | | | llvm-svn: 98140
* Don't accidentally mark some functions in construction vtables as unused. ↵Anders Carlsson2010-03-101-0/+56
| | | | | | Also land the test for a previous checkin, now that it's correct. llvm-svn: 98139
* Fix a bug with base offset merging that Devang noticed.Anders Carlsson2010-03-031-0/+58
| | | | llvm-svn: 97641
* Handle unused functions in construction vtables correctly.Anders Carlsson2010-02-281-0/+7
| | | | llvm-svn: 97406
* When laying out vtables for virtual bases in construction vtables, we need ↵Anders Carlsson2010-02-281-7/+14
| | | | | | to check if the vtable is a primary base in the layout class. llvm-svn: 97402
* Add another construction vtable test.Anders Carlsson2010-02-281-0/+43
| | | | llvm-svn: 97401
* More improvements to construction vtables; we know handle vbase offsets ↵Anders Carlsson2010-02-281-0/+53
| | | | | | correctly (I hope). llvm-svn: 97361
* Add a simple construction vtable test.Anders Carlsson2010-02-271-0/+35
| | | | llvm-svn: 97344
* Use the real base offset when calculating vbase offsets.Anders Carlsson2010-02-271-0/+46
| | | | llvm-svn: 97338
* Don't add this adjustments for pure virtual member functions.Anders Carlsson2010-02-271-1/+34
| | | | llvm-svn: 97334
* Add another test.Anders Carlsson2010-02-271-0/+48
| | | | llvm-svn: 97329
* Finish up the changes to this adjustments.Anders Carlsson2010-02-271-0/+61
| | | | llvm-svn: 97328
* Fix another vtable layout bug; we weren't looking hard enough for overriden ↵Anders Carlsson2010-02-271-0/+36
| | | | | | functions when determining if an overrider will ever be used. llvm-svn: 97306
* Handle vcall offset sharing between destructors.Anders Carlsson2010-02-271-0/+40
| | | | llvm-svn: 97304
* Fix a bug where we were generating an unnecessary vtable for a virtual base ↵Anders Carlsson2010-02-271-0/+30
| | | | | | that's already a primary virtual base. llvm-svn: 97303
* Fux a bug where we were trying to add overriders for non-virtual bases of ↵Anders Carlsson2010-02-251-0/+29
| | | | | | virtual bases more than once. llvm-svn: 97173
* More fixes. Don't try to emit a virtual base vtable if the virtual base in ↵Anders Carlsson2010-02-231-0/+29
| | | | | | question is a primary virtual base of some other base. llvm-svn: 96881
* Always emit vcall offset for the primary base, not only if it's virtual. ↵Anders Carlsson2010-02-231-0/+59
| | | | | | Remove a debug printf, and add the test case that now passes. llvm-svn: 96880
* Handle layout of vtables for virtual bases.Anders Carlsson2010-02-161-0/+27
| | | | llvm-svn: 96355
* Fix a bug where we would not emit secondary vtables for bases of a primary base.Anders Carlsson2010-02-161-0/+30
| | | | llvm-svn: 96351
* Emit vbase offsets.Anders Carlsson2010-02-161-0/+25
| | | | llvm-svn: 96329
* Don't compute final overriders or build vtables for bases that don't need a ↵Anders Carlsson2010-02-141-0/+19
| | | | | | vtable. llvm-svn: 96171
OpenPOWER on IntegriCloud