On Jul 18, 2012, at 3:20 AM, Daniel Jasper <[email protected]> wrote:

> As for this patch: I had discussions with Manuel Klimek and Chandler about it 
> before submitting but I failed including cfe-commits in these discussions. 
> Our approach was to get this in first (not changing the behavior for anyone 
> that does not specifically add the -D option) and then turn it into a plugin 
> system (as I tried to formulate in the FIXME) later. I'll start looking into 
> this now and send a plugin design proposal to cfe-dev and cfe-commits.

Okay, looking forward to the design proposal!

> As for r160369: I'll have Alex back it out again. A proper design discussion 
> would have prevented this. We'll do better next time!

Thanks!

        - Doug

> Cheers,
> Daniel
> 
> 
> On Wed, Jul 18, 2012 at 12:30 AM, Douglas Gregor <[email protected]> wrote:
> 
> On Jul 11, 2012, at 12:13 PM, Daniel Jasper <[email protected]> wrote:
> 
> > Author: djasper
> > Date: Wed Jul 11 14:13:13 2012
> > New Revision: 160061
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=160061&view=rev
> > Log:
> > 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.
> 
> I have the same concerns/complaints about this change as I did for r160369: 
> using -D options as part of the Clang build to drop in new functionality is 
> without precedent in LLVM/Clang (unless I missed something!) and needs to be 
> discussed first. It's a new and *very* different direction from the 
> library-centric approach Clang takes.
> 
>         - Doug
> 
> > Differential Revision: http://llvm-reviews.chandlerc.com/D4
> >
> > Added:
> >    cfe/trunk/lib/Tooling/CustomCompilationDatabase.h
> > Modified:
> >    cfe/trunk/lib/Tooling/CompilationDatabase.cpp
> >
> > Modified: cfe/trunk/lib/Tooling/CompilationDatabase.cpp
> > URL: 
> > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/CompilationDatabase.cpp?rev=160061&r1=160060&r2=160061&view=diff
> > ==============================================================================
> > --- cfe/trunk/lib/Tooling/CompilationDatabase.cpp (original)
> > +++ cfe/trunk/lib/Tooling/CompilationDatabase.cpp Wed Jul 11 14:13:13 2012
> > @@ -18,6 +18,10 @@
> > #include "llvm/Support/Path.h"
> > #include "llvm/Support/system_error.h"
> >
> > +#ifdef USE_CUSTOM_COMPILATION_DATABASE
> > +#include "CustomCompilationDatabase.h"
> > +#endif
> > +
> > namespace clang {
> > namespace tooling {
> >
> > @@ -124,6 +128,11 @@
> >
> > static CompilationDatabase *
> > findCompilationDatabaseFromDirectory(StringRef Directory) {
> > +#ifdef USE_CUSTOM_COMPILATION_DATABASE
> > +  if (CompilationDatabase *DB =
> > +      ::findCompilationDatabaseForDirectory(Directory))
> > +    return DB;
> > +#endif
> >   while (!Directory.empty()) {
> >     std::string LoadErrorMessage;
> >
> >
> > Added: cfe/trunk/lib/Tooling/CustomCompilationDatabase.h
> > URL: 
> > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/CustomCompilationDatabase.h?rev=160061&view=auto
> > ==============================================================================
> > --- cfe/trunk/lib/Tooling/CustomCompilationDatabase.h (added)
> > +++ cfe/trunk/lib/Tooling/CustomCompilationDatabase.h Wed Jul 11 14:13:13 
> > 2012
> > @@ -0,0 +1,37 @@
> > +//===--- CustomCompilationDatabase.h 
> > --------------------------------------===//
> > +//
> > +//                     The LLVM Compiler Infrastructure
> > +//
> > +// This file is distributed under the University of Illinois Open Source
> > +// License. See LICENSE.TXT for details.
> > +//
> > +//===----------------------------------------------------------------------===//
> > +//
> > +//  This file contains a hook to supply a custom \c CompilationDatabase
> > +//  implementation.
> > +//
> > +//  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.
> > +//
> > +//===----------------------------------------------------------------------===//
> > +
> > +#include "llvm/ADT/StringRef.h"
> > +
> > +namespace clang {
> > +namespace tooling {
> > +class CompilationDatabase;
> > +}
> > +}
> > +
> > +/// \brief Returns a CompilationDatabase for the given \c Directory.
> > +///
> > +/// \c Directory can be any directory within a project. This methods will
> > +/// then try to find compilation database files in \c Directory or any of 
> > its
> > +/// parents. If a compilation database cannot be found or loaded, returns 
> > NULL.
> > +clang::tooling::CompilationDatabase *findCompilationDatabaseForDirectory(
> > +  llvm::StringRef Directory);
> >
> >
> > _______________________________________________
> > cfe-commits mailing list
> > [email protected]
> > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
> 
> 

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to