[cfe-dev] A newbie question on getting operator in Expr

Nico Weber thakis at chromium.org
Sun Jun 26 17:19:07 PDT 2011


On Fri, Jun 17, 2011 at 10:46 PM, sirinda <sxp969 at psu.edu> wrote:
> sorry, I forgot to include the following code to check if the stmt is an
> expr.
>
> // this code is inside VisitStmt(Stmt* Node)
> if (isa<Expr>(Node)) {
>        Expr *expr = (Expr*)Node;
>        VisitExpr(expr);

For what it's worth,

  if (isa<Type>(object)) {
    Type* typedObject = (Type*)object;
    ...
  }

is usually written as

  if (Type* typedObject = dyn_cast<Type>(object)) {
    ...
  }

in clang's code.

Nico

>
> --
> View this message in context: http://clang-developers.42468.n3.nabble.com/A-newbie-question-on-getting-operator-in-Expr-tp3073430p3078936.html
> Sent from the Clang Developers mailing list archive at Nabble.com.
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>




More information about the cfe-dev mailing list