[cfe-dev] Remove implicitly generated AST nodes by Sema

Pan, Wei wei.pan at intel.com
Tue Jun 4 14:51:08 PDT 2013


For the following example, the argument in the call "foo(x)" does not have an implicit cast on top of  the CXXConstructExpr. Is it generally right to generate one for this call? If yes, then CastExpr::getSubExprAsWritten would work here.

void foo(Y y);

void bar(X x) {
   foo(x);
}

Thanks!

Wei

From: Eli Friedman [mailto:eli.friedman at gmail.com]
Sent: Tuesday, June 04, 2013 5:04 PM
To: Pan, Wei
Cc: clang-dev Developers
Subject: Re: [cfe-dev] Remove implicitly generated AST nodes by Sema


On Tue, Jun 4, 2013 at 1:26 PM, Pan, Wei <wei.pan at intel.com<mailto:wei.pan at intel.com>> wrote:
Seemly this function can only remove implicit casts. There are some AST nodes, like CXXConstructExpr in the example, which will stick there.

CastExpr::getSubExprAsWritten knows how to look through the constructor conversions in particular... it's possible that we're missing methods what you want, though.  A lot of code in clang avoids that sort of thing by just using a StmtVisitor and just ignoring expressions it doesn't want to handle.

-Eli

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130604/45906f3e/attachment.html>


More information about the cfe-dev mailing list