[cfe-dev] CFGElement changes and initializers addition (with patch)
Zhongxing Xu
xuzhongxing at gmail.com
Mon Aug 23 19:48:27 PDT 2010
> It seems a little cumbersome for users to have to check if it is a Stmt* before getting the value. We could instead do:
>
> return isStmt() ? static_cast<Stmt*>(Data.getPointer()) : NULL
>
> and have the client just use 'getStmt()' instead of 'isStmt()' + 'getStmt()'. The first approach has one less check, while the second is simpler for clients.
>
> @Jordy, Zhongxing: What do you prefer?
I prefer the latter and rename it to getAsStmt(). This pattern is used
many times in the front end.
More information about the cfe-dev
mailing list