[PATCH] D22514: CloneDetection now respects statement specific data when searching for clones.

Artem Dergachev via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 22 01:51:13 PDT 2016


NoQ added a comment.

The natural way to avoid both heavy artillery with `StmtNodes.inc` and low-performance if-chains is to use a //Visitor//.

(`Const`)`StmtVisitor` is implemented as a huge switch, contents of which are auto-generated from `StmtNodes.inc`. In fact, your approach with `StmtNodes.inc` essentially re-implements the plain `StmtVisitor`. The official visitor, of course, also allows you to fall back to the parent class if the child visit method is missing.

So i believe it's worth a try to implement `StmtDataCollector` as an auxiliary `ConstStmtVisitor`. I thought the two visitors could be combined if a plain `ConstStmtVisitor` was used from the start, but even now it seems better to me to use an extra visitor than re-invent it(?)

No other comments so far, looks good :)


https://reviews.llvm.org/D22514





More information about the cfe-commits mailing list