diff options
author | John McCall <rjmccall@apple.com> | 2012-03-30 04:25:03 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2012-03-30 04:25:03 +0000 |
commit | 56ea377bc58a3a821da917599ed26c6b37b9727c (patch) | |
tree | 8906d81a5e2a3bd7d923f2abb8a6660bdf3ee300 | |
parent | 3754f9656ab6a4648e5264d891ad5fb2f94f2a1a (diff) | |
download | clang-56ea377bc58a3a821da917599ed26c6b37b9727c.tar.gz clang-56ea377bc58a3a821da917599ed26c6b37b9727c.tar.bz2 clang-56ea377bc58a3a821da917599ed26c6b37b9727c.tar.xz |
Add a note about a missing optimization in the case of virtual
inheritance.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153722 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | NOTES.txt | 11 | ||||
-rw-r--r-- | lib/CodeGen/CGClass.cpp | 3 |
2 files changed, 14 insertions, 0 deletions
@@ -101,3 +101,14 @@ only if the non-reachability is not due to macro or template metaprogramming. //===---------------------------------------------------------------------===// + +We can still apply a modified version of the constructor/destructor +delegation optimization in cases of virtual inheritance where: + - there is no function-try-block, + - the constructor signature is not variadic, and + - the parameter variables can safely be copied and repassed + to the base constructor because either + - they have not had their addresses taken by the vbase initializers or + - they were passed indirectly. + +//===---------------------------------------------------------------------===// diff --git a/lib/CodeGen/CGClass.cpp b/lib/CodeGen/CGClass.cpp index b452c1b7ab..6303e2069d 100644 --- a/lib/CodeGen/CGClass.cpp +++ b/lib/CodeGen/CGClass.cpp @@ -731,6 +731,9 @@ void CodeGenFunction::EmitConstructorBody(FunctionArgList &Args) { EHScopeStack::stable_iterator CleanupDepth = EHStack.stable_begin(); + // TODO: in restricted cases, we can emit the vbase initializers of + // a complete ctor and then delegate to the base ctor. + // Emit the constructor prologue, i.e. the base and member // initializers. EmitCtorPrologue(Ctor, CtorType, Args); |