r184814 - [analyzer] Don't initialize virtual base classes more than once.

Jordan Rose jordan_rose at apple.com
Mon Jun 24 20:52:37 PDT 2013


On Jun 24, 2013, at 20:19 , David Blaikie <dblaikie at gmail.com> wrote:

> On Mon, Jun 24, 2013 at 6:56 PM, Jordan Rose <jordan_rose at apple.com> wrote:
>> Author: jrose
>> Date: Mon Jun 24 20:55:59 2013
>> New Revision: 184814
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=184814&view=rev
>> Log:
>> [analyzer] Don't initialize virtual base classes more than once.
>> 
>> In order to make sure virtual base classes are always initialized once,
>> the AST contains initializers for the base class in /all/ of its
>> descendents, not just the immediate descendents. However, at runtime,
>> the most-derived object is responsible for initializing all the virtual
>> base classes; all the other initializers will be ignored.
>> 
>> The analyzer now checks to see if it's being called from another base
>> constructor, and if so does not perform virtual base initialization.
> 
> Vague/uninformed question: If you modelled the C1/C2/(C3?) ctors as
> they exist would this just come out more naturally? (maybe this is a
> sufficient model of that)

My motivation for doing it this way was that I didn't want to build separate CFGs for the different constructor variants, which will be largely the same. I suppose that's not a major problem, but this seemed simple enough in practice. If more differences start coming up between complete constructors and base constructors in the analyzer's model, I/we can revisit that decision.

Jordan



More information about the cfe-commits mailing list