summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/warn-weak-vtables.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-09-23 19:04:03 +0000
committerDouglas Gregor <dgregor@apple.com>2011-09-23 19:04:03 +0000
commit34bc6e5ee401508a24cddd827c53b514dceb2347 (patch)
tree2b45f71a6b02f4951ffb8dfd640aa9707b65e8eb /clang/test/SemaCXX/warn-weak-vtables.cpp
parentc367b8f8cc2352430f434254ee4d6b23d6af59a9 (diff)
downloadbcm5719-llvm-34bc6e5ee401508a24cddd827c53b514dceb2347.tar.gz
bcm5719-llvm-34bc6e5ee401508a24cddd827c53b514dceb2347.zip
When checking for weak vtables, check whether the actual definition of
the key function is inline, rather than the original declaration. Perhaps FunctionDecl::isInlined() is poorly named. Fixes <rdar://problem/9979458>. llvm-svn: 140400
Diffstat (limited to 'clang/test/SemaCXX/warn-weak-vtables.cpp')
-rw-r--r--clang/test/SemaCXX/warn-weak-vtables.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/warn-weak-vtables.cpp b/clang/test/SemaCXX/warn-weak-vtables.cpp
index c0cfd74a3e5..912622f5a7e 100644
--- a/clang/test/SemaCXX/warn-weak-vtables.cpp
+++ b/clang/test/SemaCXX/warn-weak-vtables.cpp
@@ -29,3 +29,30 @@ void uses(A &a, B<int> &b, C &c) {
b.f();
c.f();
}
+
+// <rdar://problem/9979458>
+class Parent {
+public:
+ Parent() {}
+ virtual ~Parent();
+ virtual void * getFoo() const = 0;
+};
+
+class Derived : public Parent {
+public:
+ Derived();
+ void * getFoo() const;
+};
+
+class VeryDerived : public Derived { // expected-warning{{'VeryDerived' has no out-of-line virtual method definitions; its vtable will be emitted in every translation unit}}
+public:
+ void * getFoo() const { return 0; }
+};
+
+Parent::~Parent() {}
+
+void uses(Parent &p, Derived &d, VeryDerived &vd) {
+ p.getFoo();
+ d.getFoo();
+ vd.getFoo();
+}
OpenPOWER on IntegriCloud