Commit Graph

31 Commits

Author SHA1 Message Date
Edwin Vane 2e9b174da6 Reverting r176944 until Author fixes test failure.
llvm-svn: 176945
2013-03-13 13:48:47 +00:00
Edwin Vane 666f6b6de7 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: 176944
2013-03-13 13:36:56 +00:00
Sean Silva f1b49e237f Nuke SetUpBuildDumpLog.
Also, it was the only reason that `argc` and `argv` were being passed
into createDiagnostics, so remove those parameters and clean up callers.

llvm-svn: 172945
2013-01-20 01:58:28 +00:00
Dmitri Gribenko f857950d39 Remove useless 'llvm::' qualifier from names like StringRef and others that are
brought into 'clang' namespace by clang/Basic/LLVM.h

llvm-svn: 172323
2013-01-12 19:30:44 +00:00
Chandler Carruth 3a02247dc9 Sort all of Clang's files under 'lib', and fix up the broken headers
uncovered.

This required manually correcting all of the incorrect main-module
headers I could find, and running the new llvm/utils/sort_includes.py
script over the files.

I also manually added quite a few missing headers that were uncovered by
shuffling the order or moving headers up to be main-module-headers.

llvm-svn: 169237
2012-12-04 09:13:33 +00:00
Rafael Espindola b0448cd52a Remove some dead code. CLANG_IS_PRODUCTION is now just a build flag and
is not used in any #ifdef.

llvm-svn: 168703
2012-11-27 16:10:37 +00:00
Douglas Gregor 811db4eac4 Make DiagnosticOptions intrusively reference-counted, and make sure
the various stakeholders bump up the reference count. In particular,
the diagnostics engine now keeps the DiagnosticOptions object alive.

llvm-svn: 166508
2012-10-23 22:26:28 +00:00
Nico Weber 077a53e5ab Tooling: Add a runToolOnCodeWithArgs() function that allows
passing additional parameters to a tool.

Use this to fix a FIXME in testing code.

llvm-svn: 162889
2012-08-30 02:02:19 +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
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
Manuel Klimek 5da9dcb275 Adapts the FrontendAction convenience functions so that it can be
used with classes that generate ASTConsumers; this allows decoupling
the ASTConsumer generation from the Frontend library (like, for example,
the MatchFinder in the upcoming ASTMatcher patch).

llvm-svn: 159760
2012-07-05 18:13:01 +00:00
Alexander Kornienko 8388d24701 Fixed a problem related to resolution of built-in headers in case a path of tool's binary contains sym-links.
llvm-svn: 157944
2012-06-04 19:02:59 +00:00
NAKAMURA Takumi 4de31654bb ToolInvocation::mapVirtualFile(): Tweak for Win32. Handle the key as native path.
llvm-svn: 157889
2012-06-02 15:34:21 +00:00
Alexander Kornienko 21d6ec9224 Fix an object lifetime issue in clang/Tooling.
llvm-svn: 157759
2012-05-31 17:58:43 +00:00
Alexander Kornienko 9e8d22896c Fixed a memory leak in clang/Tooling.
llvm-svn: 157687
2012-05-30 12:10:28 +00:00
NAKAMURA Takumi 9b2d17c613 Tooling: Canonicalize Key in IndexByFile[]. llvm::sys::path::native() may be used here.
It fixes test/Tooling on Win32 hosts.

llvm-svn: 157350
2012-05-23 22:24:20 +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 f33dcb0449 Fix includes for unices that don't have chdir declared transitively.
llvm-svn: 156302
2012-05-07 10:02:55 +00:00
Manuel Klimek 74cec54b80 Includes direct.h for windows compilation.
llvm-svn: 156301
2012-05-07 09:45:46 +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 3521ae9580 Fixes a fix to finding the current directory:
We currently want to look whether PWD is available - if PWD is available it will
get us the non-resolved current path, while fs::current_path will resolve
symlinks. The long term fix is to not rely on that behavior any more.

llvm-svn: 154330
2012-04-09 18:08:23 +00:00
NAKAMURA Takumi 3a64a4b1ec Tooling.cpp: Reorder inclusions according to the conding standards.
llvm-svn: 154016
2012-04-04 13:59:41 +00:00
NAKAMURA Takumi f0c8779db4 Tooling.cpp: Don't refer to $ENV{PWD}. Use llvm::sys::fs instead.
$ENV{PWD} is not expected to be set on all hosts.

llvm-svn: 154015
2012-04-04 13:59:36 +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 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
Manuel Klimek c9675152b3 Pulls the common part of the clang-check example into Tooling, to allow new tools to be implemented without duplicating the boilerplate.
llvm-svn: 131425
2011-05-16 21:33:46 +00:00
Benjamin Kramer e63dbc373a Remove noisy semicolons.
llvm-svn: 130621
2011-04-30 19:55:55 +00:00
Manuel Klimek 6825eebcd6 This is the next step in building the standalone tools infrastructure:
This patch simplifies writing of standalone Clang tools. As an
example, we add clang-check, a tool that runs a syntax only frontend
action over a .cc file. When you integrate this into your favorite
editor, you get much faster feedback on your compilation errors, thus
reducing your feedback cycle especially when writing new code.

The tool depends on integration of an outstanding patch to CMake to
work which allows you to always have a current compile command
database in your cmake output directory when you set
CMAKE_EXPORT_COMPILE_COMMANDS.

llvm-svn: 130306
2011-04-27 16:39:14 +00:00
Manuel Klimek d861e8b7be Adds a function to run FrontendActions over in-memory code. This is
the first step towards a standalone Clang tool infrastructure.
The plan is to make it easy to build command line tools that run over
the AST of source files in a project outside of the build system.

llvm-svn: 129924
2011-04-21 18:37:41 +00:00