[cfe-commits] r113634 - /cfe/trunk/include/clang/AST/ExprCXX.h

Chris Lattner clattner at apple.com
Fri Sep 10 15:02:43 PDT 2010


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.

I fully admit that this is all my fault :-)

-Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20100910/33e67652/attachment.html>


More information about the cfe-commits mailing list