History log of /external/clang/test/CodeGenCXX/vtable-linkage.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
651f13cea278ec967336033dd032faef0e9fc2ec 24-Apr-2014 Stephen Hines <srhines@google.com> Updated to Clang 3.5a.

Change-Id: I8127eb568f674c2e72635b639a3295381fe8af82
/external/clang/test/CodeGenCXX/vtable-linkage.cpp
889a6758554c27ca4cf93502cfb5dc788cb47990 03-Sep-2013 Rafael Espindola <rafael.espindola@gmail.com> Don't emit an available_externally vtable pointing to linkonce_odr funcs.

This fixes pr13124.

From the discussion at
http://lists.cs.uiuc.edu/pipermail/cfe-dev/2012-June/022606.html
we know that we cannot make funcions in a weak_odr vtable also weak_odr. They
should remain linkonce_odr.

The side effect is that we cannot emit a available_externally vtable unless we
also emit a copy of the function. This also has an issue: If codegen is going
to output a function, sema has to mark it used. Given llvm.org/pr9114, it looks
like sema cannot be more aggressive at marking functions used because
of vtables.

This leaves us with a few unpleasant options:

* Marking functions in vtables used if possible. This sounds a bit sloppy, so
we should avoid it.
* Producing available_externally vtables only when all the functions in it are
already used or weak_odr. This would cover cases like

--------------------
struct foo {
virtual ~foo();
};
struct bar : public foo {
virtual void zed();
};
void f() {
foo *x(new bar);
delete x;
}
void g(bar *x) {
x->~bar(); // force the destructor to be used
}
--------------------------

and

----------------------------------
template<typename T>
struct bar {
virtual ~bar();
};
template<typename T>
bar<T>::~bar() {
}

// make the destructor weak_odr instead of linkonce_odr
extern template class bar<int>;

void f() {
bar<int> *x(new bar<int>);
delete x;
}
----------------------------

These look like corner cases, so it is unclear if it is worth it.

* And finally: Just nuke this optimization. That is what this patch implements.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189852 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/CodeGenCXX/vtable-linkage.cpp
134bf5d6ea6821afad5d840f594162e129f38413 27-Aug-2013 Rafael Espindola <rafael.espindola@gmail.com> Use CHECK-DAG in this test.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189280 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/CodeGenCXX/vtable-linkage.cpp
b4127a28a6dd81852469d05c611a487beb233784 16-Feb-2013 Richard Smith <richard-llvm@metafoo.co.uk> Emit vtables for an extern template class as available_externally, not as
linkonce_odr. Emit construction vtables as internal in this case, since the ABI
does not guarantee that they will be availble externally.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175330 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/CodeGenCXX/vtable-linkage.cpp
fc8f0e14ad142ed811e90fbd9a30e419e301c717 15-Apr-2011 Chris Lattner <sabre@nondot.org> fix a bunch of comment typos found by codespell. Patch by
Luis Felipe Strano Moraes!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129559 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/CodeGenCXX/vtable-linkage.cpp
691222d5c9de39e785f604c41c872279831a507e 29-Jan-2011 Anders Carlsson <andersca@mac.com> Give VTTs the right visibility.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124540 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/CodeGenCXX/vtable-linkage.cpp
f502d93b0ea970bfbd897e657f8d940a20984de2 24-Jan-2011 Anders Carlsson <andersca@mac.com> Mark VTables and RTTI data linkonce_odr instead of weak_odr, with the exception of explicit template instantiations, which have to be weak_odr.

This fixes PR6996.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124089 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/CodeGenCXX/vtable-linkage.cpp
cd3ac4bd96cb19af5117eded84bfe8320c5d787e 15-Jan-2011 Rafael Espindola <rafael.espindola@gmail.com> Also set unnamed_addr on declarations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123531 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/CodeGenCXX/vtable-linkage.cpp
62b1607e440b26f3683c92be887e8fd94af9c904 13-Jan-2011 Rafael Espindola <rafael.espindola@gmail.com> Only add unnamed_addr to definitions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123354 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/CodeGenCXX/vtable-linkage.cpp
57244f69e2e780bb5584a37a12e31be83b1eaadb 12-Jan-2011 Rafael Espindola <rafael.espindola@gmail.com> Set unnamed_addr in every type info.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123293 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/CodeGenCXX/vtable-linkage.cpp
b1c65ff108de47a89585ad37874bd6cb232664cd 11-Jan-2011 Rafael Espindola <rafael.espindola@gmail.com> Set unnamed_addr for type infos that we are confortable marking as hidden. I
think it is safe to mark all type infos with unnamed_addr, but I am not sure.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123275 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/CodeGenCXX/vtable-linkage.cpp
9f959db60e8913abafe7d5f5f5a83dc6a5c8d87e 11-Jan-2011 Rafael Espindola <rafael.espindola@gmail.com> Add unnamed_addr to vtables.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123272 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/CodeGenCXX/vtable-linkage.cpp
d2c47bde3bc0c0debd8a9728781d3375efe22bc5 11-Oct-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Make sure the VTables for template instantiations are emitted even if the key function doesn't have a body.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116186 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/CodeGenCXX/vtable-linkage.cpp
279b5eb6910d64a293e9c0e2887a05c65d8737d7 13-Aug-2010 John McCall <rjmccall@apple.com> Just disable the hidden-visibility optimization for now by hiding it behind
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
/external/clang/test/CodeGenCXX/vtable-linkage.cpp
7a536907da776bdc47a704e7cafd641e8150e653 05-Aug-2010 John McCall <rjmccall@apple.com> It turns out that linkers (at least, the Darwin linker) don't necessarily
do the right thing with mixed-visibility symbols, so disable the visibility
optimization where that's possible, i.e. with template classes (since it's
possible that an arbitrary template might be subject to an explicit
instantiation elsewhere). 447.dealII actually does this.

I've put the code under an option that's currently not hooked up to anything.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110374 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/CodeGenCXX/vtable-linkage.cpp
cbfe50224b19119e759802bd0c1463269dffd09e 04-Aug-2010 John McCall <rjmccall@apple.com> Emit standard-library RTTI with external linkage, not weak_odr.

Apply hidden visibility to most RTTI; libstdc++ does not rely on exact
pointer equality for the type info (just the type info names). Apply
the same optimization to RTTI that we do to vtables.

Fixes PR5962.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110192 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/CodeGenCXX/vtable-linkage.cpp
0c7d32bde03ae90367cb0666cf8614d425290aa3 04-Aug-2010 John McCall <rjmccall@apple.com> Extend the hidden-visibility vtables optimization to template classes that
haven't been explicitly instantiated.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110189 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/CodeGenCXX/vtable-linkage.cpp
3d640e606165daf2eaf18d52c0697f68daec106a 03-Aug-2010 John McCall <rjmccall@apple.com> Emit weak vtables of non-template classes with hidden visibility.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110107 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/CodeGenCXX/vtable-linkage.cpp
b9aefa775158b68c453e4ac0e4e2ada561900d26 25-May-2010 Daniel Dunbar <daniel@zuster.org> IRgen/C++: When mark vtables used, make sure to still append to the VTableUse array if we promote a vtable from being just used to having its definition required. This ensures that we properly inform the consumer about whether the vtable is required or not, previously we could fail to do so when the vtable was in the VTableUses array before the decl which marked it as required.
- I think this can be cleaned up, since this means we may notify the consumer about the vtable twice, but I didn't see an easy fix for this without more substantial refactoring.
- Doug, please review!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104577 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/CodeGenCXX/vtable-linkage.cpp
6fb745bdf1ff1e32caf07e42093a7920726892c1 13-May-2010 Douglas Gregor <dgregor@apple.com> Rework when and how vtables are emitted, by tracking where vtables are
"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
/external/clang/test/CodeGenCXX/vtable-linkage.cpp
35d646133ba70e5d44bc2d112ffd5e2ca262dbee 03-Apr-2010 Rafael Espindola <rafael.espindola@gmail.com> Don't produce a vtable for a class if we have an explicit template instantiation declaration and no key function. We will produce the vtable at the explicit template instantiation.

Fixes PR6748



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100266 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/CodeGenCXX/vtable-linkage.cpp
c9b64bafaf3129568f013e0c2875e1fcb9f51e6b 30-Mar-2010 Anders Carlsson <andersca@mac.com> Flip the switch and use the new vtable layout code for everything. I've verified that this passes a self-host but I'll let the bots self host as well before removing the now dead code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99861 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/CodeGenCXX/vtable-linkage.cpp
6c6bda3b0b1d8adaac2ba3f4da7056e9f1eef52e 08-Jan-2010 Eli Friedman <eli.friedman@gmail.com> 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92976 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/CodeGenCXX/vtable-linkage.cpp
c84622ae02283985ae39a0ff2ae99b43d1eebc3f 07-Jan-2010 Douglas Gregor <dgregor@apple.com> Test linkage of typeinfo and typeinfo names for class templates

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92897 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/CodeGenCXX/vtable-linkage.cpp
1a78afbde2257d01bd38a36e094d3e3231a9b412 06-Jan-2010 Douglas Gregor <dgregor@apple.com> Revert my available_externally vtables experiment. It's breaking the LLVM-with-Clang build with linker errors that I have yet to investigate.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92822 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/CodeGenCXX/vtable-linkage.cpp
074a2cf3c51229b90b77e998463530c9b06470e6 05-Jan-2010 Douglas Gregor <dgregor@apple.com> 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92779 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/CodeGenCXX/vtable-linkage.cpp
bd6d6197fcfc98356ea60e816365eb0648b69556 05-Jan-2010 Douglas Gregor <dgregor@apple.com> 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92753 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/CodeGenCXX/vtable-linkage.cpp
a5728872c7702ddd09537c95bc3cbd20e1f2fb09 15-Dec-2009 Daniel Dunbar <daniel@zuster.org> Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.
- This is designed to make it obvious that %clang_cc1 is a "test variable"
which is substituted. It is '%clang_cc1' instead of '%clang -cc1' because it
can be useful to redefine what gets run as 'clang -cc1' (for example, to set
a default target).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91446 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/CodeGenCXX/vtable-linkage.cpp
470fb73d4e09e1dfe62cb545d7fe0e567ac6e8d6 11-Dec-2009 Eli Friedman <eli.friedman@gmail.com> Fix linkage of type info and vtable for classes without linkage.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91152 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/CodeGenCXX/vtable-linkage.cpp
31b7f52d8c8d459e80d2a72176cc7fcc4b7d8d38 11-Dec-2009 Anders Carlsson <andersca@mac.com> 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
/external/clang/test/CodeGenCXX/vtable-linkage.cpp
5794c9714a7d8c7eb8003d3e2616ab389ba9e45b 06-Dec-2009 Anders Carlsson <andersca@mac.com> More linkage improvements.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90687 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/CodeGenCXX/vtable-linkage.cpp
891c8b739917ec4d171a62ceaefc640115089e7d 05-Dec-2009 Anders Carlsson <andersca@mac.com> If a class does not have a key function, its linkage should be weak_odr.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90680 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/CodeGenCXX/vtable-linkage.cpp
152d4dce59a123b9a103b3087dc3be7f0b71033e 05-Dec-2009 Anders Carlsson <andersca@mac.com> Use createGlobalVariable for creating vtable variables too.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90679 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/CodeGenCXX/vtable-linkage.cpp
7ca464366349e6b197cb521794517fa026259ee4 05-Dec-2009 Anders Carlsson <andersca@mac.com> Factor vtable related GlobalVariable creation out into a separate function. Add vtable linkage test.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90667 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/CodeGenCXX/vtable-linkage.cpp