[cfe-commits] PATCH: Rough-cut auto-detection of a build directory location for the tooling framework
klimek at google.com
Tue Jul 10 06:15:20 PDT 2012
On Tue, Jul 10, 2012 at 3:10 PM, Arnaud A. de Grandmaison
<arnaud.allarddegrandmaison at parrot.com> wrote:
> Is it necessary for 'CompilationDatabase::autoDetectFromSource' to take
> a sourcefile to seed the search, instead of using a directory ?
> Using a directory would make this function more generic.
I really want this to "just work" for the 99% case.
> For example, in a plugin like clang_complete for vim, to find a
> compilation database, you would do something like :
> 1 - autoDetectFromSource( basename(sourceFile) )
> 2 - if (no database for sourceFile or sourceFile not found in database)
> then autoDetectFromSource( getCwd() )
We can add this behavior to autoDetectFromSource if you think it's important.
I exactly *don't* want every tool to have to write their own magic
lookup-oh-where's-the-database implementation. I think that'd be hard
Also, this version is the "80% case". We'll add the other 20% incrementally.
For example, chandler wants to allow .clangrc files (which we'll
probably want when we have clangd anyway) to specify source to build
mappings and other stuff. I think we have lots of ways we can improve
this, but in general, I want tools to write autoDetectFromSource and
be done with it.
> Arnaud de Grandmaison
> On 07/10/2012 11:11 AM, Manuel Klimek wrote:
>> Please take another look.
>> On Tue, Jul 10, 2012 at 9:40 AM, Daniel Jasper <djasper at google.com> wrote:
>>> I have tried using it by putting a symlink to compile_commands.json into my
>>> llvm root and then use clang-check from within <llvm root>/tools/clang like
>>> $ clang-check lib/Tooling/CompilationDatabase.cpp
>>> LLVM ERROR: Error while opening JSON database: No such file or directory
>>> It works find if I supply the full path:
>>> $ ~/clang/build/bin/clang-check $PWD/lib/Tooling/CompilationDatabase.cpp
>>> So, it does not go up the directory tree far enough, as the
>>> Directory.empty() will be true before my symlink is reached. Can this be
>>> added? And can you add a test for such a case?
>>> +++ tools/clang/lib/Tooling/CompilationDatabase.cpp (working copy)
>>> +#include "llvm/Support/raw_ostream.h"
>>> I don't think you need this new include.
>>> On Mon, Jul 9, 2012 at 5:49 PM, Alexander Kornienko <alexfh at google.com>
>>>> Adds the CompilationDatabase::autoDetectFromSource method for supporting
>>>> build directory auto-detection for simple setups.
>>>> cfe-commits mailing list
>>>> cfe-commits at cs.uiuc.edu
>>> cfe-commits mailing list
>>> cfe-commits at cs.uiuc.edu
More information about the cfe-commits