Commit Graph

22 Commits

Author SHA1 Message Date
Mandeep Singh Grang a4c6f25016 [clang] Change std::sort to llvm::sort in response to r327219
r327219 added wrappers to std::sort which randomly shuffle the container before
sorting.  This will help in uncovering non-determinism caused due to undefined
sorting order of objects having the same key.

To make use of that infrastructure we need to invoke llvm::sort instead of
std::sort.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@328636 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-27 16:50:00 +00:00
Johannes Altmanninger abed2aa96a [clang-diff] Treat CXXCtorInitializer as a node
Reviewers: arphaman

Subscribers: cfe-commits, klimek

Differential Revision: https://reviews.llvm.org/D37002

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311865 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-27 22:52:20 +00:00
Johannes Altmanninger 2a74f265b5 [clang-diff] Remove NodeCountVisitor, NFC
Subscribers: klimek, cfe-commits

Differential Revision: https://reviews.llvm.org/D37000

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311770 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-25 09:49:49 +00:00
Johannes Altmanninger ce7e9f1524 [clang-diff] Fix getRelativeName
Handle the case when DeclContext is null.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311434 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-22 08:59:13 +00:00
Johannes Altmanninger c690c1e9f1 [clang-diff] Use the relative name for NamedDecl
Summary:
If a node referring to a name is within a class or namespace, do not use
the full qualified name, but strip the namespace prefix.

Reviewers: arphaman, bkramer

Subscribers: klimek

Differential Revision: https://reviews.llvm.org/D36681

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311433 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-22 08:56:26 +00:00
Johannes Altmanninger fbdebfae84 [clang-diff] Improve and test getNodeValue
Summary: Use qualified names if available.

Reviewers: arphaman

Subscribers: klimek

Differential Revision: https://reviews.llvm.org/D36186

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311292 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-20 16:18:43 +00:00
Johannes Altmanninger c77ca07725 [clang-diff] Fix similarity computation
Summary:
Add separate tests for the top-down and the bottom-up phase, as well as
one for the optimal matching.

Reviewers: arphaman

Subscribers: klimek

Differential Revision: https://reviews.llvm.org/D36185

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311284 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-20 12:09:07 +00:00
Johannes Altmanninger 544626fd1a [clang-diff] Filter AST nodes
Summary:
Ignore macros and implicit AST nodes, as well as anything outside of the
main source file.

Reviewers: arphaman

Subscribers: klimek

Differential Revision: https://reviews.llvm.org/D36184

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311280 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-20 10:22:32 +00:00
Johannes Altmanninger c778ea4b26 [clang-diff] Simplify mapping
Summary:
Until we find a decent heuristic on how to choose between multiple
identical trees, there is no point in supporting multiple mappings.

This also enables matching of nodes with parents of different types,
because there are many instances where this is appropriate.  For
example for and foreach statements; functions in the global or
other namespaces.

Reviewers: arphaman

Subscribers: klimek

Differential Revision: https://reviews.llvm.org/D36183

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311251 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-19 17:53:01 +00:00
Johannes Altmanninger c15e70eae8 Revert "Revert "[clang-diff] Move printing of matches and changes to clang-diff""
Fix build by renaming ChangeKind -> Change

This reverts commit 0c78c5729f.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311222 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-19 02:56:35 +00:00
Johannes Altmanninger 948113089e Revert "Revert "[clang-diff] Move the JSON export function to clang-diff""
This reverts commit eac4c13ac9, the
original commit *should* not have caused the build failure.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311216 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-19 00:57:38 +00:00
Vlad Tsyrklevich eac4c13ac9 Revert "[clang-diff] Move the JSON export function to clang-diff"
This reverts commit r311199, it was causing widespread build failures.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311211 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-18 23:21:11 +00:00
Vlad Tsyrklevich 0c78c5729f Revert "[clang-diff] Move printing of matches and changes to clang-diff"
This reverts commit r311200, it was causing widespread build failures.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311210 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-18 23:21:10 +00:00
Johannes Altmanninger ee444f1e76 [clang-diff] Move printing of matches and changes to clang-diff
Summary:
This also changes the output order of the changes. Now the matches are
printed in pre-order, intertwined with insertions, updates, and moves.
Deletions are printed afterwards.

Reviewers: arphaman

Subscribers: klimek

Differential Revision: https://reviews.llvm.org/D36179

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311200 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-18 21:26:34 +00:00
Johannes Altmanninger 5ce0ae8c6a [clang-diff] Move the JSON export function to clang-diff
Reviewers: arphaman

Subscribers: klimek

Differential Revision: https://reviews.llvm.org/D36178

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311199 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-18 21:26:13 +00:00
Johannes Altmanninger 7fe9c979c5 [clang-diff] Fix some errors and inconsistencies
Fix to the computation of the rightmost descendant.

Prevents root nodes from being mapped if they are already mapped.  This
only makes a difference when we compare AST Nodes other than entire
translation units, a feature which still has to be tested.

Reviewers: arphaman

Subscribers: klimek

Differential Revision: https://reviews.llvm.org/D36176

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311172 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-18 16:34:15 +00:00
Johannes Altmanninger 6a453c4b1e [clang-diff] Renames, NFC
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@309738 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-01 20:17:46 +00:00
Johannes Altmanninger 2982256387 [clang-diff] Move data declarations to the public header
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@309737 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-01 20:17:40 +00:00
Alex Lorenz 99f3965f2f [clang-diff] Get rid of unused variable warnings in ASTDiff.cpp
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@308737 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-21 13:18:51 +00:00
Alex Lorenz ba8e7e6c8a Fix another compiler error from r308731
std::pair in emplace back couldn't be constructed because SNodeId has an
explicit constructor. Not sure how this even compiled on my machine before.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@308734 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-21 13:04:57 +00:00
Alex Lorenz 40f4d83d41 Fix tuple construction compiler error from r308731
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@308733 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-21 12:57:40 +00:00
Alex Lorenz 02689b0536 [clang-diff] Add initial implementation
This is the first commit for the "Clang-based C/C++ diff tool" GSoC project.

ASTDiff is a new library that computes a structural AST diff between two ASTs
using the gumtree algorithm. Clang-diff is a new Clang tool that will show
the structural code changes between different ASTs.

Patch by Johannes Altmanninger!

Differential Revision: https://reviews.llvm.org/D34329


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@308731 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-21 12:49:28 +00:00