[PATCH] D30841: [clang-tidy] readability-misleading-indentation: fix chained if

Alexander Kornienko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 17 02:50:35 PDT 2017


alexfh accepted this revision.
alexfh added a comment.
This revision is now accepted and ready to land.

In https://reviews.llvm.org/D30841#702980, @fgross wrote:

> Now using `ASTContext::getParents` instead of `ChainedIfs` map.
>
> For some reason I thought of `getParents` as an expensive function to call...


Good point. It is expensive first time you call it, since it builds parents map. My idea was that since many checks use hasParent or hasAncestor matchers, the parent map will likely be built anyway, and building a (smaller) map of chained `if`s as an optimization won't make much difference. But I don't know for sure, and maybe your approach is indeed better. We can start with the parent-map based one and keep the possible optimization in mind, in case there's an evidence of performance issues.

LG. I'll submit the patch for you.


https://reviews.llvm.org/D30841





More information about the cfe-commits mailing list