ClangCompleter can now not be compiled
One more thing needs to be done though: the clang_completer.py file needs to not trigger at all when YCM has been compiled without cpp support. FIX THAT!
This commit is contained in:
parent
7992d63fb8
commit
f4d7d6ffdf
@ -74,7 +74,8 @@ else()
|
||||
"Your C++ compiler does NOT support C++11, compiling in C++03 mode." )
|
||||
endif()
|
||||
|
||||
if ( NOT EXTERNAL_LIBCLANG_PATH AND NOT USE_SYSTEM_LIBCLANG )
|
||||
if ( NOT NO_CLANG_COMPLETER AND
|
||||
( NOT EXTERNAL_LIBCLANG_PATH AND NOT USE_SYSTEM_LIBCLANG ) )
|
||||
add_subdirectory( llvm )
|
||||
endif()
|
||||
|
||||
|
@ -39,6 +39,7 @@ include_directories(
|
||||
"${CMAKE_SOURCE_DIR}/llvm/tools/clang/include"
|
||||
)
|
||||
|
||||
|
||||
file( GLOB_RECURSE SOURCES *.h *.cpp )
|
||||
|
||||
# The test sources are a part of a different target, so we remove them
|
||||
@ -50,6 +51,18 @@ if( to_remove )
|
||||
list( REMOVE_ITEM SOURCES ${to_remove} )
|
||||
endif()
|
||||
|
||||
if ( NO_CLANG_COMPLETER )
|
||||
file( GLOB_RECURSE to_remove_clang ClangCompleter/*.h ClangCompleter/*.cpp )
|
||||
|
||||
if( to_remove_clang )
|
||||
list( REMOVE_ITEM SOURCES ${to_remove_clang} )
|
||||
endif()
|
||||
|
||||
add_definitions( -DNO_CLANG_COMPLETER )
|
||||
else()
|
||||
include_directories( "${CURRENT_SOURCE_DIR}/ClangCompleter" )
|
||||
endif()
|
||||
|
||||
#############################################################################
|
||||
|
||||
# One can use the system libclang.[so|dylib] like so:
|
||||
@ -74,8 +87,10 @@ if ( EXTERNAL_LIBCLANG_PATH OR USE_SYSTEM_LIBCLANG )
|
||||
set( LIBCLANG_TARGET ${EXTERNAL_LIBCLANG_PATH} )
|
||||
message(
|
||||
"Using external libclang: ${EXTERNAL_LIBCLANG_PATH}" )
|
||||
else()
|
||||
elseif( NOT NO_CLANG_COMPLETER )
|
||||
set( LIBCLANG_TARGET libclang_static )
|
||||
else()
|
||||
set( LIBCLANG_TARGET )
|
||||
endif()
|
||||
|
||||
if ( EXTRA_RPATH )
|
||||
|
@ -17,12 +17,15 @@
|
||||
|
||||
#include "CandidateRepository.h"
|
||||
#include "Candidate.h"
|
||||
#include "CompletionData.h"
|
||||
#include "standard.h"
|
||||
#include "Utils.h"
|
||||
|
||||
#include <boost/thread/locks.hpp>
|
||||
|
||||
#ifndef NO_CLANG_COMPLETER
|
||||
# include "CompletionData.h"
|
||||
#endif // NO_CLANG_COMPLETER
|
||||
|
||||
namespace YouCompleteMe
|
||||
{
|
||||
|
||||
@ -74,6 +77,7 @@ std::vector< const Candidate* > CandidateRepository::GetCandidatesForStrings(
|
||||
return candidates;
|
||||
}
|
||||
|
||||
#ifndef NO_CLANG_COMPLETER
|
||||
|
||||
std::vector< const Candidate* > CandidateRepository::GetCandidatesForStrings(
|
||||
const std::vector< CompletionData > &datas )
|
||||
@ -99,6 +103,7 @@ std::vector< const Candidate* > CandidateRepository::GetCandidatesForStrings(
|
||||
return candidates;
|
||||
}
|
||||
|
||||
#endif // NO_CLANG_COMPLETER
|
||||
|
||||
CandidateRepository::~CandidateRepository()
|
||||
{
|
||||
|
@ -44,8 +44,10 @@ public:
|
||||
std::vector< const Candidate* > GetCandidatesForStrings(
|
||||
const std::vector< std::string > &strings );
|
||||
|
||||
#ifndef NO_CLANG_COMPLETER
|
||||
std::vector< const Candidate* > GetCandidatesForStrings(
|
||||
const std::vector< CompletionData > &datas );
|
||||
#endif // NO_CLANG_COMPLETER
|
||||
|
||||
private:
|
||||
CandidateRepository() {};
|
||||
@ -63,4 +65,3 @@ private:
|
||||
} // namespace YouCompleteMe
|
||||
|
||||
#endif /* end of include guard: CANDIDATEREPOSITORY_H_K9OVCMHG */
|
||||
|
||||
|
@ -92,15 +92,15 @@ public:
|
||||
std::string filepath );
|
||||
|
||||
// Only provided for tests!
|
||||
std::vector< std::string > CandidatesForQuery(
|
||||
const std::string &query ) const;
|
||||
std::vector< std::string > CandidatesForQuery(
|
||||
const std::string &query ) const;
|
||||
|
||||
std::vector< std::string > CandidatesForQueryAndType(
|
||||
const std::string &query,
|
||||
const std::string &filetype ) const;
|
||||
|
||||
Future< AsyncResults > CandidatesForQueryAndTypeAsync(
|
||||
const std::string &query,
|
||||
Future< AsyncResults > CandidatesForQueryAndTypeAsync(
|
||||
const std::string &query,
|
||||
const std::string &filetype ) const;
|
||||
|
||||
private:
|
||||
|
@ -16,11 +16,14 @@
|
||||
// along with YouCompleteMe. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "IdentifierCompleter.h"
|
||||
#include "ClangCompleter.h"
|
||||
#include "Future.h"
|
||||
#include "CompletionData.h"
|
||||
#include "Diagnostic.h"
|
||||
#include "UnsavedFile.h"
|
||||
|
||||
#ifndef NO_CLANG_COMPLETER
|
||||
# include "ClangCompleter.h"
|
||||
# include "CompletionData.h"
|
||||
# include "Diagnostic.h"
|
||||
# include "UnsavedFile.h"
|
||||
#endif // NO_CLANG_COMPLETER
|
||||
|
||||
#include <boost/python.hpp>
|
||||
#include <boost/utility.hpp>
|
||||
@ -31,47 +34,6 @@ BOOST_PYTHON_MODULE(ycm_core)
|
||||
using namespace boost::python;
|
||||
using namespace YouCompleteMe;
|
||||
|
||||
// TODO: rename these *Vec classes to *Vector; don't forget the python file
|
||||
class_< std::vector< std::string >,
|
||||
boost::shared_ptr< std::vector< std::string > > >( "StringVec" )
|
||||
.def( vector_indexing_suite< std::vector< std::string > >() );
|
||||
|
||||
class_< CompletionData >( "CompletionData" )
|
||||
.def( "TextToInsertInBuffer", &CompletionData::TextToInsertInBuffer )
|
||||
.def( "MainCompletionText", &CompletionData::MainCompletionText )
|
||||
.def( "ExtraMenuInfo", &CompletionData::ExtraMenuInfo )
|
||||
.def( "DetailedInfoForPreviewWindow",
|
||||
&CompletionData::DetailedInfoForPreviewWindow )
|
||||
.def_readonly( "kind_", &CompletionData::kind_ );
|
||||
|
||||
class_< std::vector< CompletionData >,
|
||||
boost::shared_ptr< std::vector< CompletionData > > >(
|
||||
"CompletionVec" )
|
||||
.def( vector_indexing_suite< std::vector< CompletionData > >() );
|
||||
|
||||
class_< Diagnostic >( "Diagnostic" )
|
||||
.def_readonly( "line_number_", &Diagnostic::line_number_ )
|
||||
.def_readonly( "column_number_", &Diagnostic::column_number_ )
|
||||
.def_readonly( "kind_", &Diagnostic::kind_ )
|
||||
.def_readonly( "filename_", &Diagnostic::filename_ )
|
||||
.def_readonly( "text_", &Diagnostic::text_ )
|
||||
.def_readonly( "long_formatted_text_", &Diagnostic::long_formatted_text_ );
|
||||
|
||||
class_< std::vector< Diagnostic > >( "DiagnosticVec" )
|
||||
.def( vector_indexing_suite< std::vector< Diagnostic > >() );
|
||||
|
||||
class_< Future< AsyncResults > >( "FutureResults" )
|
||||
.def( "ResultsReady", &Future< AsyncResults >::ResultsReady )
|
||||
.def( "GetResults", &Future< AsyncResults >::GetResults );
|
||||
|
||||
class_< Future< AsyncCompletions > >( "FutureCompletions" )
|
||||
.def( "ResultsReady", &Future< AsyncCompletions >::ResultsReady )
|
||||
.def( "GetResults", &Future< AsyncCompletions >::GetResults );
|
||||
|
||||
class_< Future< void > >( "FutureVoid" )
|
||||
.def( "ResultsReady", &Future< void >::ResultsReady )
|
||||
.def( "GetResults", &Future< void >::GetResults );
|
||||
|
||||
class_< IdentifierCompleter, boost::noncopyable >( "IdentifierCompleter" )
|
||||
.def( "EnableThreading", &IdentifierCompleter::EnableThreading )
|
||||
.def( "AddCandidatesToDatabase",
|
||||
@ -81,11 +43,29 @@ BOOST_PYTHON_MODULE(ycm_core)
|
||||
.def( "CandidatesForQueryAndTypeAsync",
|
||||
&IdentifierCompleter::CandidatesForQueryAndTypeAsync );
|
||||
|
||||
// TODO: rename these *Vec classes to *Vector; don't forget the python file
|
||||
class_< std::vector< std::string >,
|
||||
boost::shared_ptr< std::vector< std::string > > >( "StringVec" )
|
||||
.def( vector_indexing_suite< std::vector< std::string > >() );
|
||||
|
||||
class_< Future< AsyncResults > >( "FutureResults" )
|
||||
.def( "ResultsReady", &Future< AsyncResults >::ResultsReady )
|
||||
.def( "GetResults", &Future< AsyncResults >::GetResults );
|
||||
|
||||
class_< Future< void > >( "FutureVoid" )
|
||||
.def( "ResultsReady", &Future< void >::ResultsReady )
|
||||
.def( "GetResults", &Future< void >::GetResults );
|
||||
|
||||
#ifndef NO_CLANG_COMPLETER
|
||||
class_< Future< AsyncCompletions > >( "FutureCompletions" )
|
||||
.def( "ResultsReady", &Future< AsyncCompletions >::ResultsReady )
|
||||
.def( "GetResults", &Future< AsyncCompletions >::GetResults );
|
||||
|
||||
// CAREFUL HERE! For filename and contents we are referring directly to
|
||||
// Python-allocated and -managed memory since we are accepting pointers to
|
||||
// data members of python objects. We need to ensure that those objects
|
||||
// outlive our UnsavedFile objects.
|
||||
class_< UnsavedFile >( "UnsavedFile" )
|
||||
class_< UnsavedFile >( "UnsavedFile" )
|
||||
.add_property( "filename_",
|
||||
make_getter( &UnsavedFile::filename_ ),
|
||||
make_setter( &UnsavedFile::filename_,
|
||||
@ -96,8 +76,8 @@ BOOST_PYTHON_MODULE(ycm_core)
|
||||
return_value_policy< reference_existing_object >() ) )
|
||||
.def_readwrite( "length_", &UnsavedFile::length_ );
|
||||
|
||||
class_< std::vector< UnsavedFile > >( "UnsavedFileVec" )
|
||||
.def( vector_indexing_suite< std::vector< UnsavedFile > >() );
|
||||
class_< std::vector< UnsavedFile > >( "UnsavedFileVec" )
|
||||
.def( vector_indexing_suite< std::vector< UnsavedFile > >() );
|
||||
|
||||
class_< ClangCompleter, boost::noncopyable >( "ClangCompleter" )
|
||||
.def( "EnableThreading", &ClangCompleter::EnableThreading )
|
||||
@ -107,4 +87,30 @@ BOOST_PYTHON_MODULE(ycm_core)
|
||||
&ClangCompleter::UpdateTranslationUnitAsync )
|
||||
.def( "CandidatesForQueryAndLocationInFileAsync",
|
||||
&ClangCompleter::CandidatesForQueryAndLocationInFileAsync );
|
||||
|
||||
class_< CompletionData >( "CompletionData" )
|
||||
.def( "TextToInsertInBuffer", &CompletionData::TextToInsertInBuffer )
|
||||
.def( "MainCompletionText", &CompletionData::MainCompletionText )
|
||||
.def( "ExtraMenuInfo", &CompletionData::ExtraMenuInfo )
|
||||
.def( "DetailedInfoForPreviewWindow",
|
||||
&CompletionData::DetailedInfoForPreviewWindow )
|
||||
.def_readonly( "kind_", &CompletionData::kind_ );
|
||||
|
||||
class_< std::vector< CompletionData >,
|
||||
boost::shared_ptr< std::vector< CompletionData > > >(
|
||||
"CompletionVec" )
|
||||
.def( vector_indexing_suite< std::vector< CompletionData > >() );
|
||||
|
||||
class_< Diagnostic >( "Diagnostic" )
|
||||
.def_readonly( "line_number_", &Diagnostic::line_number_ )
|
||||
.def_readonly( "column_number_", &Diagnostic::column_number_ )
|
||||
.def_readonly( "kind_", &Diagnostic::kind_ )
|
||||
.def_readonly( "filename_", &Diagnostic::filename_ )
|
||||
.def_readonly( "text_", &Diagnostic::text_ )
|
||||
.def_readonly( "long_formatted_text_", &Diagnostic::long_formatted_text_ );
|
||||
|
||||
class_< std::vector< Diagnostic > >( "DiagnosticVec" )
|
||||
.def( vector_indexing_suite< std::vector< Diagnostic > >() );
|
||||
|
||||
#endif // NO_CLANG_COMPLETER
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user