[cfe-dev] ConditionalOperator::setCond is gone

Olaf Krzikalla Olaf.Krzikalla at tu-dresden.de
Wed Mar 9 02:14:42 PST 2011


Hi,

Am 08.03.2011 16:59, schrieb Douglas Gregor:
> Yes, we have been removing setXXX member functions, because mutating an AST in-place is extremely dangerous.
Hmm that sounds really nasty. If all setXXX member functions are gone, 
then there are no means to efficiently manipulate an AST, aren't there?

> AST mutations look local, but it's very easy for them to have non-local effects that break the invariants of the AST.
>
> Plus, immutable ASTs are far better when dealing with serialized representations of ASTs, because coping with in-place modifications to ASTs when serializing again is *extremely* complicated. See, for example, the chained PCH work in the AST reader/writer.
Until now I hadn't any problems, but I didn't serialize manipulated ASTs 
but rather rewrite them only. The question is whether it is worth to 
sacrifce options for safety. If you take into account that I am a C++ - 
programmer, then you know the answer :-)


Best regards
Olaf Krzikalla




More information about the cfe-dev mailing list