This is an archive of the discontinued LLVM Phabricator instance.

Add method to ignore invisible AST nodes
ClosedPublic

Authored by steveire on Nov 22 2019, 12:11 PM.

Diff Detail

Event Timeline

steveire created this revision.Nov 22 2019, 12:11 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 22 2019, 12:11 PM
aaron.ballman added inline comments.Dec 10 2019, 1:00 PM
clang/include/clang/AST/Expr.h
769–770

Invisible is a bit of an odd term because the AST nodes themselves are in fact visible within the AST. I think this means "invisible" as in "not corresponding directly to syntax the user wrote". Bikeshedding some other names:

  • IgnoreAllImplicitExprs
  • IgnoreAllImplicitNodes
  • IgnoreNodesNotWrittenByUser
  • IgnoreNotWrittenInSource

other suggestions welcome.

clang/lib/AST/Expr.cpp
3024–3026

Can remove the spurious newline, and these should be named according to the usual naming conventions (I'd go with E and LastE, but feel free to pick less terrible names).

3032

Drop top-level const (I wouldn't be sad if it also lost the auto at the same time).

3034

const auto *

3036

const Expr *

3037

!isa<CXXTemporaryObjectExpr>(C) since you're not using the returned value anyway.

3042

const auto *

3043

const Expr *

Are you sure you mean to skip parens here, as those are written in source?

3044

Elide braces

steveire marked 10 inline comments as done.Dec 10 2019, 1:37 PM

It wasn't possible to add the const because of the return type.

clang/include/clang/AST/Expr.h
769–770

Changed as discussed on IRC.

This revision is now accepted and ready to land.Dec 11 2019, 5:41 AM
This revision was automatically updated to reflect the committed changes.