[cfe-dev] [cfe-commits] Design proposal: Add custom compilation database formats as plugins

Sean Silva silvas at purdue.edu
Wed Jul 18 14:45:36 PDT 2012


I was looking at adding compilation database support for ninja build
files. However, I ran into the problem that it basically amounted to
rewriting the entire ninja build file parser that is already
implemented inside of ninja. As such, it seems like the very nature of
compilation databases is something that needs to be output by the tool
configuring/doing the build.

Is your thought with this that, for example, ninja would provide a
compilation database plugin reusing its own parser?

--Sean Silva

On Wed, Jul 18, 2012 at 6:36 AM, Daniel Jasper <djasper at google.com> wrote:
> Hi all,
>
> to make the tooling library more widely applicable, we'd like to make the
> CompilationDatabase architecture extensible, i.e. provide the option of
> implementing custom adapters to other kinds of compilation databases (other
> than the currently available JSONCompilationDatabase).
>
> In r160061, I provided a hack that enables this, but we definitely want
> something nicer.
>
> In the attached patch, I am using LLVM's plugin registry to enable
> registering new compilation databases. To provide a new CompilationDatabase,
> you'd need to subclass CompilationDatabasePlugin and CompilationDatabase and
> register the former with CompilationDatabasePluginRegistry::Add (as shown
> for JSONCompilationDatabase). This is not a finished patch for review, I'd
> just like to get feedback on the approach. What do you think?
>
> Also, several points that need to be addressed:
> - Error handling: In CompilationDatabase::loadFromDirectory, I currently
> simply try each plugin until I find a compilation database. Any ideas, what
> I should do with the error messages, especially if I do not find any
> compilation database. Should I concatenate them, potentially with the
> plugin-name as a prefix?
> - Should I move the JSONCompilationDatabase to a separate set of files as it
> is now loosely coupled?
>
> Cheers,
> Daniel
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>



More information about the cfe-dev mailing list