[cfe-commits] [Differential] D4: Hooks for custom CompilationDatabase

Manuel Klimek klimek at google.com
Wed Jul 11 08:18:31 PDT 2012


!accept

On Wed, Jul 11, 2012 at 4:48 PM, djasper (Daniel Jasper)
<noreply at llvm-reviews.chandlerc.com> wrote:
> djasper updated the revision "Hooks for custom CompilationDatabase".
>
>   Modified comment according to suggestion and fixed spelling.
>
> Reviewers: klimek
>
> REVISION DETAIL
>   http://llvm-reviews.chandlerc.com/D4
>
> CHANGE SINCE LAST DIFF
>   http://llvm-reviews.chandlerc.com/D4?vs=15&id=16#differential-review-toc
>
> AFFECTED FILES
>   lib/Tooling/CompilationDatabase.cpp
>   lib/Tooling/CustomCompilationDatabase.h
>
> CHANGE DETAILS
> Index: lib/Tooling/CompilationDatabase.cpp
> ===================================================================
> --- lib/Tooling/CompilationDatabase.cpp
> +++ lib/Tooling/CompilationDatabase.cpp
> @@ -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;
>
> Index: lib/Tooling/CustomCompilationDatabase.h
> ===================================================================
> --- /dev/null
> +++ lib/Tooling/CustomCompilationDatabase.h
> @@ -0,0 +1,33 @@
> +//===--- 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.
> +clang::tooling::CompilationDatabase *findCompilationDatabaseForDirectory(
> +  llvm::StringRef Directory);
>
> REPLY HANDLER ACTIONS
>   Reply to comment, or !reject, !abandon, !reclaim, !resign, !rethink, !unsubscribe, !accept.
>
> To: klimek, djasper
> Cc: cfe-commits



More information about the cfe-commits mailing list