[PATCH] D39648: [clang-diff] NFC: organise header

Johannes Altmanninger via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Nov 5 10:57:59 PST 2017


johannes created this revision.
Herald added a subscriber: klimek.

https://reviews.llvm.org/D39648

Files:
  include/clang/Tooling/ASTDiff/ASTDiff.h
  lib/Tooling/ASTDiff/ASTDiff.cpp


Index: lib/Tooling/ASTDiff/ASTDiff.cpp
===================================================================
--- lib/Tooling/ASTDiff/ASTDiff.cpp
+++ lib/Tooling/ASTDiff/ASTDiff.cpp
@@ -27,6 +27,10 @@
 namespace clang {
 namespace diff {
 
+bool ComparisonOptions::isMatchingAllowed(NodeRef N1, NodeRef N2) const {
+  return N1.getType().isSame(N2.getType());
+}
+
 class ASTDiff::Impl {
 private:
   std::unique_ptr<NodeId[]> SrcToDst, DstToSrc;
Index: include/clang/Tooling/ASTDiff/ASTDiff.h
===================================================================
--- include/clang/Tooling/ASTDiff/ASTDiff.h
+++ include/clang/Tooling/ASTDiff/ASTDiff.h
@@ -36,6 +36,24 @@
 
 using NodeRef = const Node &;
 
+struct ComparisonOptions {
+  /// During top-down matching, only consider nodes of at least this height.
+  int MinHeight = 2;
+
+  /// During bottom-up matching, match only nodes with at least this value as
+  /// the ratio of their common descendants.
+  double MinSimilarity = 0.5;
+
+  /// Whenever two subtrees are matched in the bottom-up phase, the optimal
+  /// mapping is computed, unless the size of either subtrees exceeds this.
+  int MaxSize = 100;
+
+  bool StopAfterTopDown = false;
+
+  /// Returns false if the nodes should never be matched.
+  bool isMatchingAllowed(NodeRef N1, NodeRef N2) const;
+};
+
 class ASTDiff {
 public:
   ASTDiff(SyntaxTree &Src, SyntaxTree &Dst, const ComparisonOptions &Options);
@@ -123,26 +141,6 @@
   bool operator!=(const NodeRefIterator &Other) const;
 };
 
-struct ComparisonOptions {
-  /// During top-down matching, only consider nodes of at least this height.
-  int MinHeight = 2;
-
-  /// During bottom-up matching, match only nodes with at least this value as
-  /// the ratio of their common descendants.
-  double MinSimilarity = 0.5;
-
-  /// Whenever two subtrees are matched in the bottom-up phase, the optimal
-  /// mapping is computed, unless the size of either subtrees exceeds this.
-  int MaxSize = 100;
-
-  bool StopAfterTopDown = false;
-
-  /// Returns false if the nodes should never be matched.
-  bool isMatchingAllowed(NodeRef N1, NodeRef N2) const {
-    return N1.getType().isSame(N2.getType());
-  }
-};
-
 } // end namespace diff
 } // end namespace clang
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39648.121636.patch
Type: text/x-patch
Size: 2244 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171105/c2deeec7/attachment.bin>


More information about the cfe-commits mailing list