Skip to content

Commit 8831303

Browse files
committed
Add a note about a missing optimization in the case of virtual
inheritance. llvm-svn: 153722
1 parent 5a125b4 commit 8831303

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

clang/NOTES.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,14 @@ only if the non-reachability is not due to macro or template
101101
metaprogramming.
102102

103103
//===---------------------------------------------------------------------===//
104+
105+
We can still apply a modified version of the constructor/destructor
106+
delegation optimization in cases of virtual inheritance where:
107+
- there is no function-try-block,
108+
- the constructor signature is not variadic, and
109+
- the parameter variables can safely be copied and repassed
110+
to the base constructor because either
111+
- they have not had their addresses taken by the vbase initializers or
112+
- they were passed indirectly.
113+
114+
//===---------------------------------------------------------------------===//

clang/lib/CodeGen/CGClass.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -731,6 +731,9 @@ void CodeGenFunction::EmitConstructorBody(FunctionArgList &Args) {
731731

732732
EHScopeStack::stable_iterator CleanupDepth = EHStack.stable_begin();
733733

734+
// TODO: in restricted cases, we can emit the vbase initializers of
735+
// a complete ctor and then delegate to the base ctor.
736+
734737
// Emit the constructor prologue, i.e. the base and member
735738
// initializers.
736739
EmitCtorPrologue(Ctor, CtorType, Args);

0 commit comments

Comments
 (0)