On Sep 10, 2010, at 3:02 PM, Chris Lattner wrote:

> 
> On Sep 10, 2010, at 2:59 PM, Douglas Gregor wrote:
> 
>> 
>> On Sep 10, 2010, at 2:15 PM, Sebastian Redl wrote:
>> 
>>> Author: cornedbee
>>> Date: Fri Sep 10 16:15:56 2010
>>> New Revision: 113634
>>> 
>>> URL: http://llvm.org/viewvc/llvm-project?rev=113634&view=rev
>>> Log:
>>> Follow Ted's example and hide CXXNoexceptExpr's setters from all but 
>>> serialization.
>> 
>> I've actually been leaning toward removing the setters entirely, then 
>> letting serialization poke at the fields directly.
> 
> I completely agree.  In the Expr classes, I think that all the ivars should 
> be public.  Ones that are fixed at construction time (like the ivars in 
> types) should just be marked const:
> 
> class FloatingLiteral : public Expr {
> public:
>   APFloatStorage Num;
>   bool IsExact : 1;
>   SourceLocation Loc;
> private:
>   FloatingLiteral(ASTContext &C, const llvm::APFloat &V, bool isexact,
>                   QualType Type, SourceLocation L)
>     : Expr(FloatingLiteralClass, Type, false, false),
>       IsExact(isexact), Loc(L) {
>     setValue(C, V);
>   }
> ...
> 
> I don't see any reason to have tons of ivars that have trivial getters and 
> setters, it's just a lot of redundant code.

Please don't. Having explicit getters makes it easier for us to tweak the 
internal representation (to save space, or keep track of more information, or 
whatever). In general, we shouldn't have setters [*], and serialization should 
just poke at the fields directly.

        - Doug

[*] Most of these are my fault, since we're taking blame ;)
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to