Commit Graph

90 Commits

Author SHA1 Message Date
Johannes Altmanninger 41395022a3 [clang-diff] Treat CXXCtorInitializer as a node
Reviewers: arphaman

Subscribers: cfe-commits, klimek

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

llvm-svn: 311865
2017-08-27 22:52:20 +00:00
Johannes Altmanninger a3c4923a53 [clang-diff] Reformat test, NFC
llvm-svn: 311571
2017-08-23 16:32:35 +00:00
Jacob Gravelle 46307d7350 [clang-diff] Refactor stop-after command-line flag
Summary:
Rename stop-after to stop-diff-after. When building LLVM with
-DLLVM_BUILD_LLVM_DYLIB=ON, stop-after collides with the stop-after
already present in LLVM.

Reviewers: johannes, arphaman

Subscribers: klimek, aheejin, cfe-commits

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

llvm-svn: 311476
2017-08-22 17:42:44 +00:00
Johannes Altmanninger 2b955ffaed [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

llvm-svn: 311433
2017-08-22 08:56:26 +00:00
Johannes Altmanninger d6491f2c4a Allow thiscall attribute in test/Tooling/clang-diff-ast.cpp
llvm-svn: 311301
2017-08-20 20:13:33 +00:00
Johannes Altmanninger 0dd86dc5f1 [clang-diff] Improve and test getNodeValue
Summary: Use qualified names if available.

Reviewers: arphaman

Subscribers: klimek

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

llvm-svn: 311292
2017-08-20 16:18:43 +00:00
Johannes Altmanninger d196930799 [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

llvm-svn: 311284
2017-08-20 12:09:07 +00:00
Johannes Altmanninger d5b56a8619 [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

llvm-svn: 311280
2017-08-20 10:22:32 +00:00
NAKAMURA Takumi 6adf81b1d5 clang/test/Tooling/clang-diff-ast.cpp: Satisfy thiscall.
clang/test/Tooling/clang-diff-ast.cpp:45:12: error: expected string not found in input
   // CHECK: CXXConstructorDecl: X(void (char, int))
             ^
  <stdin>:43:25: note: scanning from here
   AccessSpecDecl: public(42)
                          ^
  <stdin>:44:2: note: possible intended match here
   CXXConstructorDecl: X(void (char, int) __attribute__((thiscall)))(43)
   ^

llvm-svn: 311270
2017-08-20 00:02:20 +00:00
Johannes Altmanninger 51321aef8e [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

llvm-svn: 311251
2017-08-19 17:53:01 +00:00
Johannes Altmanninger a29d6aeced [clang-diff] Add HTML side-by-side diff output
Reviewers: arphaman

Subscribers: mgorny

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

llvm-svn: 311241
2017-08-19 15:40:45 +00:00
Johannes Altmanninger 683876ca6d [clang-diff] Make printing of matches optional
Reviewers: arphaman

Subscribers: klimek

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

llvm-svn: 311237
2017-08-19 12:04:04 +00:00
Johannes Altmanninger c58ac104d1 [clang-diff] Fix test
llvm-svn: 311233
2017-08-19 10:05:24 +00:00
Johannes Altmanninger a1d2b5d54f [clang-diff] Add option to dump the AST, one node per line
Summary:
This is done with -ast-dump; the JSON variant has been renamed to
-ast-dump-json.

Reviewers: arphaman

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

llvm-svn: 311232
2017-08-19 09:36:14 +00:00
Johannes Altmanninger e0fe5cd4f3 Revert "Revert "[clang-diff] Move printing of matches and changes to clang-diff""
Fix build by renaming ChangeKind -> Change

This reverts commit 0c78c5729f29315d7945988efd048c0cb86c07ce.

llvm-svn: 311222
2017-08-19 02:56:35 +00:00
Johannes Altmanninger b2d26c303e [clang-diff] Fix test for python 3
llvm-svn: 311220
2017-08-19 01:34:24 +00:00
Johannes Altmanninger 0da12c841a Revert "Revert "[clang-diff] Move the JSON export function to clang-diff""
This reverts commit eac4c13ac9ea8f12bc049e040c7b9c8a517f54e7, the
original commit *should* not have caused the build failure.

llvm-svn: 311216
2017-08-19 00:57:38 +00:00
Vlad Tsyrklevich deb2a2adc8 Revert "[clang-diff] Move the JSON export function to clang-diff"
This reverts commit r311199, it was causing widespread build failures.

llvm-svn: 311211
2017-08-18 23:21:11 +00:00
Vlad Tsyrklevich ebcb773f7d Revert "[clang-diff] Move printing of matches and changes to clang-diff"
This reverts commit r311200, it was causing widespread build failures.

llvm-svn: 311210
2017-08-18 23:21:10 +00:00
Johannes Altmanninger 69774d67c8 [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

llvm-svn: 311200
2017-08-18 21:26:34 +00:00
Johannes Altmanninger 0ad4cc61ac [clang-diff] Move the JSON export function to clang-diff
Reviewers: arphaman

Subscribers: klimek

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

llvm-svn: 311199
2017-08-18 21:26:13 +00:00
Johannes Altmanninger 849f20e4a2 [clang-diff] Add commandline arguments.
Summary:
Support command line options for build path and extra arguments
This emulates the options accepted by clang tools that use CommonOptionsParser.

Add a flag for controlling the maximum size parameter for bottom up matching.

Reviewers: arphaman

Subscribers: klimek

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

llvm-svn: 311173
2017-08-18 16:34:22 +00:00
Kuba Mracek 5b57633a45 [clang] Get rid of "%T" expansions
The %T lit expansion expands to a common directory shared between all the tests in the same directory, which is unexpected and unintuitive, and more importantly, it's been a source of subtle race conditions and flaky tests. In https://reviews.llvm.org/D35396, it was agreed that it would be best to simply ban %T and only keep %t, which is unique to each test. When a test needs a temporary directory, it can just create one using mkdir %t.

This patch removes %T in clang.

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

llvm-svn: 310950
2017-08-15 19:47:06 +00:00
Alex Lorenz a75b2cac71 [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

llvm-svn: 308731
2017-07-21 12:49:28 +00:00
Michal Gorny 638ac70a92 [test] Port clang tests to canonicalized booleans
Use the new llvm_canonicalize_cmake_booleans() function to canonicalize
booleans for lit tests. Replace the duplicate ENABLE_CLANG* variables
used to hold canonicalized values with in-place canonicalization. Use
implicit logic in Python code to avoid overrelying on exact 0/1 values.

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

llvm-svn: 293052
2017-01-25 13:11:45 +00:00
Benjamin Kramer 023ef1bd13 Back out the test case for r266973 for now.
It breaks on windows, need to investigate. It's not testing the
important part of that change anyways.

llvm-svn: 266975
2016-04-21 10:46:14 +00:00
Benjamin Kramer b5737c1491 [Tooling] Inject -resource-dir instead of overwriting argv[0].
This allows using a different standard library (the one from argv[0] in
the compilation database) with the correct builtins.

Differential Revision: http://reviews.llvm.org/D19356

llvm-svn: 266973
2016-04-21 10:18:18 +00:00
Artyom Skrobov d08cb6c528 int function without a return statement is invalid C++.
Changing the return type to void.

llvm-svn: 254206
2015-11-27 18:10:49 +00:00
Adrian Prantl 8c73ba65bb Change the expectation for test/Tooling/ms-asm-no-target.cpp since
clang-check now initializes the available targets to support
clang module containers.

llvm-svn: 241656
2015-07-08 01:39:38 +00:00
NAKAMURA Takumi 06ac98299f Remove "REQUIRES:shell" from tests. They work for me.
llvm-svn: 221269
2014-11-04 13:41:33 +00:00
NAKAMURA Takumi 69e32f4562 clang/test/Tooling: Remove mention to PR15590 out of a couple of tests. They are suppressed with another issue.
llvm-svn: 221267
2014-11-04 13:32:29 +00:00
NAKAMURA Takumi 83910ae5b6 clang/test/Tooling: [PR15590] Avoid backslashes in JSON. Should work on win32.
llvm-svn: 221266
2014-11-04 13:32:17 +00:00
NAKAMURA Takumi 1fb02cb62e clang/test: Introduce the feature "staticanalyzer" for --enable-clang-static-analyzer.
llvm-svn: 213140
2014-07-16 12:05:45 +00:00
Arnaud A. de Grandmaison 59615698d5 PR19601: testcase improvement
The test can now catch all cases:
 - no removal of the 'no-integrated-as' flag
 - bogus removal of the flag, like when the remove_if was not followed by an erase

llvm-svn: 207787
2014-05-01 19:36:13 +00:00
Artyom Skrobov 67e6d506d8 Adding a win32-targeted test into Tooling/multi-jobs.cpp, to make sure it doesn't get broken again
(prompted by NAKAMURA Takumi)

llvm-svn: 197596
2013-12-18 18:55:36 +00:00
Artyom Skrobov 3a4fe36916 clang-check to ignore -no-integrated-as because certain drivers can't handle it
llvm-svn: 197229
2013-12-13 13:43:48 +00:00
NAKAMURA Takumi 3a4036a1ce clang/test/Tooling/multi-jobs.cpp: Mark this as XFAIL:msvc for now. It has been failing since r194968.
MSVC targeted drivers (*-win32) are incapable of invoking external assembler.

llvm-svn: 194992
2013-11-18 06:57:47 +00:00
Alp Toker 9c5ae47c94 Ignore test Inputs globally and remove redundant lit.local.cfg files
By adding a default config.excludes pattern we can avoid individual
suppressions in subdirectories.

This matches LLVM's lit.cfg which also excludes a few other common non-test
filenames for consistency.

llvm-svn: 194814
2013-11-15 13:37:49 +00:00
Alp Toker e994ebda14 Improve the missing ASM parser test for MS-style assembly
It's better to test clang-check rather than the internal c-index-test utility.

Also adds a target so we can remove the XFAILs.

Thanks to Richard Barton for spotting the test failure on ARM.

Test originally from r193685.

llvm-svn: 194249
2013-11-08 06:50:48 +00:00
Ariel J. Bernal 31c181b061 Fixed replacements for files with relative paths are not applied.
Replacements were no applied when using a compilation database with paths in the
compilation command relative to the compile directory. This patch makes those
paths abosulte.

llvm-svn: 191776
2013-10-01 14:59:00 +00:00
Rafael Espindola c7367ffdab Simplify now that llvm::sys::current_path checks $PWD.
llvm-svn: 188128
2013-08-10 01:40:10 +00:00
Rafael Espindola 925213b0fa Add 'not' to commands that are expected to fail.
This is at least good documentation, but also opens the possibility of
using pipefail.

llvm-svn: 185652
2013-07-04 16:16:58 +00:00
Pavel Labath c3282c0b3c Add support for static analysis to clang-check
Summary:
This adds a command line argument '-analyze' to clang-check which runs the
clang static analyzer on the source files.

Reviewers: klimek

CC: cfe-commits, revane

Differential Revision: http://llvm-reviews.chandlerc.com/D926

llvm-svn: 183399
2013-06-06 12:35:43 +00:00
Pavel Labath dee20c105b ClangTool: strip -o from the command line
Summary:
This patch creates a new ArgumentsAdjuster, which removes all -o parameters from
the command line. This adjuster is inserted by default into the ClangTool pipeline.

Reviewers: klimek

CC: cfe-commits, revane

Differential Revision: http://llvm-reviews.chandlerc.com/D925

llvm-svn: 183398
2013-06-06 11:52:19 +00:00
Pavel Labath 951ad647a0 clang-check: Enable specification of additional compiler arguments
Summary:
This adds two command-line parameters: -extra-arg and -extra-arg-before, which
enable the user to pass additional parameters to the compiler command.

Reviewers: klimek

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D919

llvm-svn: 183320
2013-06-05 16:23:30 +00:00
Jordan Rose 4fec903717 Use 'env' in tests that set environment variables.
Patch by David Fang!

llvm-svn: 181861
2013-05-15 01:45:37 +00:00
Aaron Ballman a69c905756 As of r180836, these tests should no longer be XFAILed on Windows.
llvm-svn: 180853
2013-05-01 15:16:52 +00:00
Fariborz Jahanian b0d81f8626 Added PR number for failing win64 tests.
llvm-svn: 177886
2013-03-25 18:56:45 +00:00
Fariborz Jahanian c56ae1b677 These tests fail on our Window64 machine.
Feel free to revert them (or let me know and I will revert)
if they shouldn't be.

llvm-svn: 177743
2013-03-22 17:42:39 +00:00
Edwin Vane 34794c5b3d ClangTool output cleanup
Information messages sent to stdout by ClangTool now only happen when the
-debug flag is set.

Error messages that used to go to stdout now go to stderr.

Author: Ariel J Bernal <ariel.j.bernal@intel.com>
llvm-svn: 177177
2013-03-15 20:14:01 +00:00