Index: src/SynTree/Expression.cc
===================================================================
--- src/SynTree/Expression.cc	(revision d0d5054760ab76c71a7924fa81844c667bb70757)
+++ src/SynTree/Expression.cc	(revision c0bf94ec8b5f4f0f6a4ac9de014bc1d596f29233)
@@ -271,13 +271,13 @@
 }
 
-CastExpr::CastExpr( Expression *arg_, Type *toType ) : Expression(), arg(arg_) {
+CastExpr::CastExpr( Expression *arg, Type *toType, bool isGenerated ) : Expression(), arg(arg), isGenerated( isGenerated ) {
 	set_result(toType);
 }
 
-CastExpr::CastExpr( Expression *arg_ ) : Expression(), arg(arg_) {
+CastExpr::CastExpr( Expression *arg, bool isGenerated ) : Expression(), arg(arg), isGenerated( isGenerated ) {
 	set_result( new VoidType( Type::Qualifiers() ) );
 }
 
-CastExpr::CastExpr( const CastExpr &other ) : Expression( other ), arg( maybeClone( other.arg ) ) {
+CastExpr::CastExpr( const CastExpr &other ) : Expression( other ), arg( maybeClone( other.arg ) ), isGenerated( other.isGenerated ) {
 }
 
Index: src/SynTree/Expression.h
===================================================================
--- src/SynTree/Expression.h	(revision d0d5054760ab76c71a7924fa81844c667bb70757)
+++ src/SynTree/Expression.h	(revision c0bf94ec8b5f4f0f6a4ac9de014bc1d596f29233)
@@ -188,7 +188,8 @@
   public:
 	Expression * arg;
-
-	CastExpr( Expression * arg );
-	CastExpr( Expression * arg, Type * toType );
+	bool isGenerated = true; // whether this cast appeared in the source program
+
+	CastExpr( Expression * arg, bool isGenerated = true );
+	CastExpr( Expression * arg, Type * toType, bool isGenerated = true );
 	CastExpr( const CastExpr & other );
 	virtual ~CastExpr();
