#include "clang/Tooling/ASTDiff/ASTDiff.h"
#include "clang/AST/ParentMapContext.h"
#include "clang/AST/RecursiveASTVisitor.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Lex/Lexer.h"
#include "llvm/ADT/PriorityQueue.h"
#include <limits>
#include <memory>
#include <optional>
#include <unordered_set>
usingnamespacellvm;
usingnamespaceclang;
namespace clang {
namespace diff {
namespace {
class Mapping { … };
}
class ASTDiff::Impl { … };
class SyntaxTree::Impl { … };
static bool isSpecializedNodeExcluded(const Decl *D) { … }
static bool isSpecializedNodeExcluded(const Stmt *S) { … }
static bool isSpecializedNodeExcluded(CXXCtorInitializer *I) { … }
template <class T>
static bool isNodeExcluded(const SourceManager &SrcMgr, T *N) { … }
namespace {
struct PreorderVisitor : public RecursiveASTVisitor<PreorderVisitor> { … };
}
SyntaxTree::Impl::Impl(SyntaxTree *Parent, ASTContext &AST)
: … { … }
SyntaxTree::Impl::Impl(SyntaxTree *Parent, Decl *N, ASTContext &AST)
: … { … }
SyntaxTree::Impl::Impl(SyntaxTree *Parent, Stmt *N, ASTContext &AST)
: … { … }
static std::vector<NodeId> getSubtreePostorder(const SyntaxTree::Impl &Tree,
NodeId Root) { … }
static std::vector<NodeId> getSubtreeBfs(const SyntaxTree::Impl &Tree,
NodeId Root) { … }
void SyntaxTree::Impl::initTree() { … }
void SyntaxTree::Impl::setLeftMostDescendants() { … }
int SyntaxTree::Impl::getNumberOfDescendants(NodeId Id) const { … }
bool SyntaxTree::Impl::isInSubtree(NodeId Id, NodeId SubtreeRoot) const { … }
int SyntaxTree::Impl::findPositionInParent(NodeId Id, bool Shifted) const { … }
std::string
SyntaxTree::Impl::getRelativeName(const NamedDecl *ND,
const DeclContext *Context) const { … }
std::string SyntaxTree::Impl::getRelativeName(const NamedDecl *ND) const { … }
static const DeclContext *getEnclosingDeclContext(ASTContext &AST,
const Stmt *S) { … }
static std::string getInitializerValue(const CXXCtorInitializer *Init,
const PrintingPolicy &TypePP) { … }
std::string SyntaxTree::Impl::getNodeValue(NodeId Id) const { … }
std::string SyntaxTree::Impl::getNodeValue(const Node &N) const { … }
std::string SyntaxTree::Impl::getDeclValue(const Decl *D) const { … }
std::string SyntaxTree::Impl::getStmtValue(const Stmt *S) const { … }
struct SNodeId { … };
class Subtree { … };
class ZhangShashaMatcher { … };
ASTNodeKind Node::getType() const { … }
StringRef Node::getTypeLabel() const { … }
std::optional<std::string> Node::getQualifiedIdentifier() const { … }
std::optional<StringRef> Node::getIdentifier() const { … }
namespace {
struct HeightLess { … };
}
namespace {
class PriorityList { … };
}
bool ASTDiff::Impl::identical(NodeId Id1, NodeId Id2) const { … }
bool ASTDiff::Impl::isMatchingPossible(NodeId Id1, NodeId Id2) const { … }
bool ASTDiff::Impl::haveSameParents(const Mapping &M, NodeId Id1,
NodeId Id2) const { … }
void ASTDiff::Impl::addOptimalMapping(Mapping &M, NodeId Id1,
NodeId Id2) const { … }
double ASTDiff::Impl::getJaccardSimilarity(const Mapping &M, NodeId Id1,
NodeId Id2) const { … }
NodeId ASTDiff::Impl::findCandidate(const Mapping &M, NodeId Id1) const { … }
void ASTDiff::Impl::matchBottomUp(Mapping &M) const { … }
Mapping ASTDiff::Impl::matchTopDown() const { … }
ASTDiff::Impl::Impl(SyntaxTree::Impl &T1, SyntaxTree::Impl &T2,
const ComparisonOptions &Options)
: … { … }
void ASTDiff::Impl::computeMapping() { … }
void ASTDiff::Impl::computeChangeKinds(Mapping &M) { … }
ASTDiff::ASTDiff(SyntaxTree &T1, SyntaxTree &T2,
const ComparisonOptions &Options)
: … { … }
ASTDiff::~ASTDiff() = default;
NodeId ASTDiff::getMapped(const SyntaxTree &SourceTree, NodeId Id) const { … }
SyntaxTree::SyntaxTree(ASTContext &AST)
: … { … }
SyntaxTree::~SyntaxTree() = default;
const ASTContext &SyntaxTree::getASTContext() const { … }
const Node &SyntaxTree::getNode(NodeId Id) const { … }
int SyntaxTree::getSize() const { … }
NodeId SyntaxTree::getRootId() const { … }
SyntaxTree::PreorderIterator SyntaxTree::begin() const { … }
SyntaxTree::PreorderIterator SyntaxTree::end() const { … }
int SyntaxTree::findPositionInParent(NodeId Id) const { … }
std::pair<unsigned, unsigned>
SyntaxTree::getSourceRangeOffsets(const Node &N) const { … }
std::string SyntaxTree::getNodeValue(NodeId Id) const { … }
std::string SyntaxTree::getNodeValue(const Node &N) const { … }
}
}