This is an archive of the discontinued LLVM Phabricator instance.

Hooks for custom CompilationDatabase
ClosedPublic

Authored by djasper on Jul 11 2012, 6:41 AM.

Details

Summary

Add a hook to supply a custom CompilationDatabase. To add a custom CompilationDatabase, make it implement findCompilationDatabaseForDirectory in CustomCompilationDatabase.h and set USE_COSTUM_COMPILATION_DATABASE.

Diff Detail

Event Timeline

Do we want to add a FIXME comment about where we want this to go in the future, so others can jump in and run ahead easily? The CustomCompilationDatabase.h header comment would seem like the perfect place.

For example:
The mechanism can be used by IDEs or non-public code bases to integrate with their build system. Currently we support statically linking in an implementation of \c findCompilationDatabaseForDirectory and enabling it with -DUSE_CUSTOM_COMPILATION_DATABASE when compiling the Tooling library.

FIXME: The strategy forward is to provide a plugin system that can load custom compilation databases and make enabling that a build option.

lib/Tooling/CompilationDatabase.cpp
21 ↗(On Diff #15)

I think that's either spelled COSTUME or CUSTOM.

djasper updated this revision to Unknown Object (????).Jul 11 2012, 7:48 AM

Modified comment according to suggestion and fixed spelling.

klimek accepted this revision.Jul 11 2012, 8:18 AM

The code looks fine, but see my comment below...

lib/Tooling/CustomCompilationDatabase.h
31 ↗(On Diff #16)

What are the semantics of Directory? Which directory will be passed in? That of the file? The project? The working directory?

How will we even identify the project directory if we don't have the compilation database file?

I think there are some unanswered interface and design questions here.

djasper updated this revision to Unknown Object (????).Jul 11 2012, 10:30 AM

Add comment explaining (a suggestion for) the interface.

djasper updated this revision to Unknown Object (????).Jul 11 2012, 11:16 AM

Restrict interface to directories.

djasper updated this revision to Unknown Object (????).Jul 11 2012, 11:18 AM

Typo..

lib/Tooling/CustomCompilationDatabase.h
31 ↗(On Diff #16)

I suggest this comment as interface definition. What do you think?

djasper closed this revision.Jul 11 2012, 12:13 PM

Closed by commit rL160061 (authored by @djasper).