[PATCH] D20795: Added basic capabilities to detect source code clones.

Raphael Isemann via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 25 16:58:47 PDT 2016


teemperor added inline comments.

================
Comment at: lib/Analysis/CloneDetection.cpp:178
@@ +177,3 @@
+
+  bool VisitFunctionDecl(FunctionDecl *D) {
+    // If we found a function, we start the clone search on its body statement.
----------------
NoQ wrote:
> You'd probably want to add `ObjCMethodDecl` and `BlockDecl`, because they aren't sub-classes of `FunctionDecl` (and probably even tests for that).
> 
> Because this part of the code essentially re-implements `AnalysisConsumer`, (a `RecursiveASTVisitor` that tells us what code bodies to analyze with the static analyzer - i should've looked there earlier!!).
> 
> Alternatively, you can just rely on `AnalysisConsumer`, which would eliminate the recursive visitor completely: {F2205103} This way you'd be analyzing exactly the same code bodies that the analyzer itself would analyze; if you'd want to extend to various declarations, you'd be able to do that by subscribing on `check::ASTDecl`. But i dare not to predict what kind of different flexibility you'd need next.
Thanks for the patch!


https://reviews.llvm.org/D20795





More information about the cfe-commits mailing list