[clang] ab1add6 - [clang] Move the definition of ASTDiff (NFC)

Kazu Hirata via cfe-commits cfe-commits at lists.llvm.org
Sun Jan 23 13:28:25 PST 2022


Author: Kazu Hirata
Date: 2022-01-23T13:28:02-08:00
New Revision: ab1add6adc444371268ddbcb169a509559abd9dc

URL: https://github.com/llvm/llvm-project/commit/ab1add6adc444371268ddbcb169a509559abd9dc
DIFF: https://github.com/llvm/llvm-project/commit/ab1add6adc444371268ddbcb169a509559abd9dc.diff

LOG: [clang] Move the definition of ASTDiff (NFC)

This patch moves the definition of ASTDiff later within the header
file.

Without this patch, the header depends on the forward decalrations of
SyntaxTree and ComparisonOptions from another header file, which is
not desirable.  Since SyntaxTree and ComparisonOptions are defined in
ASTDiff.h, we can move the definition of ASTDiff later and stop
relying on the forward declarations from another header file.

Added: 
    

Modified: 
    clang/include/clang/Tooling/ASTDiff/ASTDiff.h

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/Tooling/ASTDiff/ASTDiff.h b/clang/include/clang/Tooling/ASTDiff/ASTDiff.h
index c772ad84c1390..5fe6db6cb133b 100644
--- a/clang/include/clang/Tooling/ASTDiff/ASTDiff.h
+++ b/clang/include/clang/Tooling/ASTDiff/ASTDiff.h
@@ -48,20 +48,6 @@ struct Node {
   llvm::Optional<std::string> getQualifiedIdentifier() const;
 };
 
-class ASTDiff {
-public:
-  ASTDiff(SyntaxTree &Src, SyntaxTree &Dst, const ComparisonOptions &Options);
-  ~ASTDiff();
-
-  // Returns the ID of the node that is mapped to the given node in SourceTree.
-  NodeId getMapped(const SyntaxTree &SourceTree, NodeId Id) const;
-
-  class Impl;
-
-private:
-  std::unique_ptr<Impl> DiffImpl;
-};
-
 /// SyntaxTree objects represent subtrees of the AST.
 /// They can be constructed from any Decl or Stmt.
 class SyntaxTree {
@@ -120,6 +106,20 @@ struct ComparisonOptions {
   }
 };
 
+class ASTDiff {
+public:
+  ASTDiff(SyntaxTree &Src, SyntaxTree &Dst, const ComparisonOptions &Options);
+  ~ASTDiff();
+
+  // Returns the ID of the node that is mapped to the given node in SourceTree.
+  NodeId getMapped(const SyntaxTree &SourceTree, NodeId Id) const;
+
+  class Impl;
+
+private:
+  std::unique_ptr<Impl> DiffImpl;
+};
+
 } // end namespace 
diff 
 } // end namespace clang
 


        


More information about the cfe-commits mailing list