Commit Graph

35 Commits

Author SHA1 Message Date
Alexander Kornienko 2018618b4d Fixed crash and added a test and a minor output problem
llvm-svn: 162110
2012-08-17 17:38:39 +00:00
Richard Smith 235341bc88 Store SourceManager pointer on PrintingPolicy in the case where we're dumping,
and remove ASTContext reference (which was frequently bound to a dereferenced
null pointer) from the recursive lump of printPretty functions. In so doing,
fix (at least) one case where we intended to use the 'dump' mode, but that
failed because a null ASTContext reference had been passed in.

llvm-svn: 162011
2012-08-16 03:56:14 +00:00
Richard Smith 52f04a2e8f Don't constant-fold when pretty-printing alignment attribute. This fixes a
potential crasher -- Context is sometimes a null reference (!!) here.

llvm-svn: 162007
2012-08-16 02:43:29 +00:00
Alexander Kornienko bf4871d363 Implemented -ast-dump, -ast-print, -ast-dump-filter options in clang-check
llvm-svn: 161753
2012-08-13 10:50:08 +00:00
Manuel Klimek 8c9a6bcae6 Fix typo.
llvm-svn: 161106
2012-08-01 08:48:27 +00:00
Manuel Klimek d627ec8a05 This test actually works on Win32...
llvm-svn: 161048
2012-07-31 14:45:10 +00:00
Manuel Klimek 3aad855a89 Fixes a segfault in Tooling when using pch's:
Clear the FileManager's stat cache in between running
translation units, as the stat cache loaded from a pch
is only valid for one compiler invocation.

llvm-svn: 161047
2012-07-31 13:56:54 +00:00
Alexander Kornienko cdc3987ca8 Removed standalone clang-ast-dump tool.
llvm-svn: 160772
2012-07-26 01:44:18 +00:00
Chandler Carruth 1649088ba1 Switch to the canonical pipe-based testing of clang output using
FileCheck.

This avoids copying files around needlessly during test runs.

llvm-svn: 160535
2012-07-20 00:49:53 +00:00
NAKAMURA Takumi b7fa0d58fa clang/test/Tooling/clang-ast-dump.cpp: Mark it as REQUIRES: asserts, for now.
llvm-svn: 160332
2012-07-17 00:33:36 +00:00
Ted Kremenek cf74cef104 This test appears to be passing on win32.
llvm-svn: 160320
2012-07-16 21:17:01 +00:00
Alexander Kornienko 277f6cf805 Fixing an obvious bug in a test.
llvm-svn: 160268
2012-07-16 13:31:37 +00:00
Alexander Kornienko f2f82550fd The new clang-ast-dump tool for selective AST dumping. Moved common command-line tool stuff to CommandLineClangTool
llvm-svn: 160265
2012-07-16 12:46:48 +00:00
Arnaud A. de Grandmaison 617f5269c3 Adds support for auto-detection of compilation databases, looking in a directory and all its parents.
llvm-svn: 159998
2012-07-10 16:56:35 +00:00
Manuel Klimek a9c86c980b Fixes the MSVC build.
llvm-svn: 159992
2012-07-10 14:21:30 +00:00
Manuel Klimek 65fd0e1fd3 Adds support for auto-detection of compilation databases
from a source file and changes clang-check to make use of this.

This makes clang-check just work on in-tree builds, and allows
easy setup via a symlink per source directory to make clang-check
work without any extra configuration.

llvm-svn: 159990
2012-07-10 13:10:51 +00:00
NAKAMURA Takumi 5ad41dab52 clang/test/Tooling: Update comments in left 2 tests on XFAIL. They are incompatible to -fms-compatibility.
llvm-svn: 157352
2012-05-23 22:24:33 +00:00
NAKAMURA Takumi 2e8124b6df clang/test/Tooling: Tweak 4 tests to escape the path separator s/\\/\\\\/g in JSON.
llvm-svn: 157351
2012-05-23 22:24:27 +00:00
NAKAMURA Takumi c910b6d075 test/Tooling/clang-check-pwd.cpp: Mark as XFAIL:mingw for now. Fixing is work-in-progress.
llvm-svn: 157170
2012-05-20 22:28:03 +00:00
NAKAMURA Takumi 01152f9c63 clang/test/Tooling: Remark as XFAIL again in 5 tests for msvc hosts.
FIXME: JSON doesn't like path separator '\', on Win32 hosts.
llvm-svn: 156957
2012-05-16 22:14:14 +00:00
NAKAMURA Takumi faf78d5665 clang/test/Tooling: Remove XFAIL in 5 tests to unveil the real failure.
FYI, they can pass on Cygwin w/o any tweaks.

llvm-svn: 156930
2012-05-16 17:38:04 +00:00
NAKAMURA Takumi fe3fa7867e clang/test/Tooling/clang-check-pwd.cpp: Add "REQUIRES: shell".
This passes on MSYS bash and Cygwin.

llvm-svn: 156929
2012-05-16 17:37:56 +00:00
Simon Atanasyan 32df72db66 Declare abstract class ArgumentsAdjuster. This abstract interface describes
a command line argument adjuster, which is responsible for command line
arguments modification before the arguments are used to run a frontend action.

Define class ClangSyntaxOnlyAdjuster implements ArgumentsAdjuster interface.
This class converts input command line arguments to the "syntax check only"
variant.

Reviewed by Manuel Klimek.

llvm-svn: 156478
2012-05-09 16:18:30 +00:00
Manuel Klimek 805d8dc52a Fixes resolution of relative paths when running clang tools.
The chdir is not the perfect fix, as it is thread hostile. The
real fix will be to make -working-dir work correctly, which will
take time to implement. Before that, the tooling library cannot
be used concurrently.

llvm-svn: 156299
2012-05-07 09:17:48 +00:00
Manuel Klimek 3778a435d1 Fixes the header search logic for tools:
The driver needs to get the correct path to the executable to deduce
the header search path.

llvm-svn: 155542
2012-04-25 09:25:41 +00:00
Manuel Klimek ff26efceb4 Adds a FixedCompilationDatabase to be able to specify tool parameters
at the command line.

llvm-svn: 154989
2012-04-18 07:41:50 +00:00
Kaelyn Uhrain 606b5291e5 Fix quoting to allow shell expansion to occur for shell variables
introduced by the test harness' expansion of %t.

llvm-svn: 154443
2012-04-10 22:27:27 +00:00
Manuel Klimek 1baf89eac9 Fix tautological FileCheck by moving the CHECK to an extra line.
llvm-svn: 154393
2012-04-10 12:12:33 +00:00
Manuel Klimek 35fa2655dd Implementing a test for the use of PWD to base finding the
correct compile commands on, based on an idea by Jordan Rose.

llvm-svn: 154335
2012-04-09 19:10:04 +00:00
NAKAMURA Takumi 2b9219eea1 clang/test/Tooling/clang-check.cpp: Mark it as XFAIL also on cygwin.
It seems clang-check doesn't like gcc driver on cygming. Investigating.

llvm-svn: 154066
2012-04-04 23:23:19 +00:00
NAKAMURA Takumi 67458e3696 clang/test/Tooling/clang-check.cpp: Mark it as XFAIL mingw,msvc for now.
It seems JSON parser doesn't like path separator '\' on Win32 hosts.

llvm-svn: 154017
2012-04-04 14:35:23 +00:00
Manuel Klimek 47c245a537 Adds a tooling library.
Provides an API to run clang tools (FrontendActions) as standalone tools,
or repeatedly in-memory in a process. This is useful for unit-testing,
map-reduce style applications, source transformation daemons or command line
tools.

The ability to run over multiple translation units with different command
line arguments enables building up refactoring tools that need to apply
transformations across translation unit boundaries.

See tools/clang-check/ClangCheck.cpp for an example.

llvm-svn: 154008
2012-04-04 12:07:46 +00:00
Manuel Klimek 8a160cc42b Reverts the Tooling changes as requested by Chris.
llvm-svn: 132462
2011-06-02 16:58:33 +00:00
Manuel Klimek 6fad7119b9 Fix test breakage due to example not being built.
llvm-svn: 132376
2011-06-01 00:18:08 +00:00
Manuel Klimek 0cfc6a045c This patch implements an AST matching framework that allows to write
tools that match on the C++ ASTs. The main interface is in ASTMatchers.h,
an example implementation of a tool that removes redundant .c_str() calls
is in the example RemoveCStrCalls.cpp.

Various contributions:
Zhanyong Wan, Chandler Carruth, Marcin Kowalczyk, Wei Xu, James Dennett.

llvm-svn: 132374
2011-05-31 23:49:32 +00:00