NoQ added a comment.

Regarding the cache stack - it feels easier for me to allocate a separate stack 
for each statement, and put the stack on stack (!) rather than having it 
global. This way it'd be automatically cleaned for you when VisitStmt() exits, 
and you'd be able to address child cache by index rather then through scanning.


================
Comment at: lib/Analysis/CloneDetection.cpp:142
@@ +141,3 @@
+/// Afterwards, the hash values of the children are calculated into the
+/// computed hash value.
+class HashVisitor : public RecursiveASTVisitor<HashVisitor> {
----------------
> This calculation happens in linear time and each statement is only visited a
> fixed amount of times during this process.

Isn't `SaveAllSubSequences()` quadratic?

================
Comment at: lib/Analysis/CloneDetection.cpp:424
@@ +423,3 @@
+  // remove any duplicates.
+  std::sort(IndexesToRemove.begin(), IndexesToRemove.end(),
+            std::greater<unsigned>());
----------------
I suspect that all //i//'s that make it into the `IndexesToRemove` vector are 
already unique and increasing, by construction. We take some //i//, see if we 
need to remove it, then push it at most once and take (//i// + 1).


https://reviews.llvm.org/D20795



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to