2012/4/4 Manuel Klimek <[email protected]>: > Author: klimek > Date: Wed Apr 4 07:07:46 2012 > New Revision: 154008 > > URL: http://llvm.org/viewvc/llvm-project?rev=154008&view=rev > Log: > 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.
> Added: cfe/trunk/lib/Tooling/Tooling.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/Tooling.cpp?rev=154008&view=auto > ============================================================================== > --- cfe/trunk/lib/Tooling/Tooling.cpp (added) > +++ cfe/trunk/lib/Tooling/Tooling.cpp Wed Apr 4 07:07:46 2012 > +#include "clang/Tooling/Tooling.h" > +#include "clang/Tooling/CompilationDatabase.h" > +#include "llvm/ADT/STLExtras.h" > +#include "llvm/Support/Host.h" > +#include "llvm/Support/raw_ostream.h" > +#include "clang/Driver/Compilation.h" > +#include "clang/Driver/Driver.h" > +#include "clang/Driver/Tool.h" > +#include "clang/Frontend/CompilerInstance.h" > +#include "clang/Frontend/FrontendAction.h" > +#include "clang/Frontend/FrontendDiagnostic.h" > +#include "clang/Frontend/TextDiagnosticPrinter.h" llvm/* may be included later. Fixed in r154016. > +ClangTool::ClangTool(const CompilationDatabase &Compilations, > + ArrayRef<std::string> SourcePaths) > + : Files((FileSystemOptions())) { > + StringRef BaseDirectory(::getenv("PWD")); ::getenv("PWD") might be NULL. Fixed in r154015. test/Tooling/clang-check has been failing regardless of my fix. Probably due to '\' in json. Command 5: "FileCheck" "E:\bb-win7\cmake-clang-i686-msvc10\llvm-project\clang\test\Tooling\clang-check.cpp" Command 5 Result: 1 Command 5 Output: Command 5 Stderr: E:\bb-win7\cmake-clang-i686-msvc10\llvm-project\clang\test\Tooling\clang-check.cpp:8:20: error: expected string not found in input invalid; // CHECK: C++ requires ^ <stdin>:1:1: note: scanning from here error: error reading 'E:bb-win7cmake-clang-i686-msvc10buildtoolsclangtestToolingOutputclang-check.cpp.tmp/test.cpp' ^ <stdin>:1:10: note: possible intended match here error: error reading 'E:bb-win7cmake-clang-i686-msvc10buildtoolsclangtestToolingOutputclang-check.cpp.tmp/test.cpp' ^ ...Takumi _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
