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:
Strahinja Val Markovic 2012-08-17 13:32:42 -07:00
parent 7992d63fb8
commit f4d7d6ffdf
18 changed files with 84 additions and 56 deletions

View File

@ -74,7 +74,8 @@ else()
"Your C++ compiler does NOT support C++11, compiling in C++03 mode." ) "Your C++ compiler does NOT support C++11, compiling in C++03 mode." )
endif() 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 ) add_subdirectory( llvm )
endif() endif()

View File

@ -39,6 +39,7 @@ include_directories(
"${CMAKE_SOURCE_DIR}/llvm/tools/clang/include" "${CMAKE_SOURCE_DIR}/llvm/tools/clang/include"
) )
file( GLOB_RECURSE SOURCES *.h *.cpp ) file( GLOB_RECURSE SOURCES *.h *.cpp )
# The test sources are a part of a different target, so we remove them # 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} ) list( REMOVE_ITEM SOURCES ${to_remove} )
endif() 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: # 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} ) set( LIBCLANG_TARGET ${EXTERNAL_LIBCLANG_PATH} )
message( message(
"Using external libclang: ${EXTERNAL_LIBCLANG_PATH}" ) "Using external libclang: ${EXTERNAL_LIBCLANG_PATH}" )
else() elseif( NOT NO_CLANG_COMPLETER )
set( LIBCLANG_TARGET libclang_static ) set( LIBCLANG_TARGET libclang_static )
else()
set( LIBCLANG_TARGET )
endif() endif()
if ( EXTRA_RPATH ) if ( EXTRA_RPATH )

View File

@ -17,12 +17,15 @@
#include "CandidateRepository.h" #include "CandidateRepository.h"
#include "Candidate.h" #include "Candidate.h"
#include "CompletionData.h"
#include "standard.h" #include "standard.h"
#include "Utils.h" #include "Utils.h"
#include <boost/thread/locks.hpp> #include <boost/thread/locks.hpp>
#ifndef NO_CLANG_COMPLETER
# include "CompletionData.h"
#endif // NO_CLANG_COMPLETER
namespace YouCompleteMe namespace YouCompleteMe
{ {
@ -74,6 +77,7 @@ std::vector< const Candidate* > CandidateRepository::GetCandidatesForStrings(
return candidates; return candidates;
} }
#ifndef NO_CLANG_COMPLETER
std::vector< const Candidate* > CandidateRepository::GetCandidatesForStrings( std::vector< const Candidate* > CandidateRepository::GetCandidatesForStrings(
const std::vector< CompletionData > &datas ) const std::vector< CompletionData > &datas )
@ -99,6 +103,7 @@ std::vector< const Candidate* > CandidateRepository::GetCandidatesForStrings(
return candidates; return candidates;
} }
#endif // NO_CLANG_COMPLETER
CandidateRepository::~CandidateRepository() CandidateRepository::~CandidateRepository()
{ {

View File

@ -44,8 +44,10 @@ public:
std::vector< const Candidate* > GetCandidatesForStrings( std::vector< const Candidate* > GetCandidatesForStrings(
const std::vector< std::string > &strings ); const std::vector< std::string > &strings );
#ifndef NO_CLANG_COMPLETER
std::vector< const Candidate* > GetCandidatesForStrings( std::vector< const Candidate* > GetCandidatesForStrings(
const std::vector< CompletionData > &datas ); const std::vector< CompletionData > &datas );
#endif // NO_CLANG_COMPLETER
private: private:
CandidateRepository() {}; CandidateRepository() {};
@ -63,4 +65,3 @@ private:
} // namespace YouCompleteMe } // namespace YouCompleteMe
#endif /* end of include guard: CANDIDATEREPOSITORY_H_K9OVCMHG */ #endif /* end of include guard: CANDIDATEREPOSITORY_H_K9OVCMHG */

View File

@ -16,11 +16,14 @@
// along with YouCompleteMe. If not, see <http://www.gnu.org/licenses/>. // along with YouCompleteMe. If not, see <http://www.gnu.org/licenses/>.
#include "IdentifierCompleter.h" #include "IdentifierCompleter.h"
#include "ClangCompleter.h"
#include "Future.h" #include "Future.h"
#include "CompletionData.h"
#include "Diagnostic.h" #ifndef NO_CLANG_COMPLETER
#include "UnsavedFile.h" # include "ClangCompleter.h"
# include "CompletionData.h"
# include "Diagnostic.h"
# include "UnsavedFile.h"
#endif // NO_CLANG_COMPLETER
#include <boost/python.hpp> #include <boost/python.hpp>
#include <boost/utility.hpp> #include <boost/utility.hpp>
@ -31,47 +34,6 @@ BOOST_PYTHON_MODULE(ycm_core)
using namespace boost::python; using namespace boost::python;
using namespace YouCompleteMe; 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" ) class_< IdentifierCompleter, boost::noncopyable >( "IdentifierCompleter" )
.def( "EnableThreading", &IdentifierCompleter::EnableThreading ) .def( "EnableThreading", &IdentifierCompleter::EnableThreading )
.def( "AddCandidatesToDatabase", .def( "AddCandidatesToDatabase",
@ -81,6 +43,24 @@ BOOST_PYTHON_MODULE(ycm_core)
.def( "CandidatesForQueryAndTypeAsync", .def( "CandidatesForQueryAndTypeAsync",
&IdentifierCompleter::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 // CAREFUL HERE! For filename and contents we are referring directly to
// Python-allocated and -managed memory since we are accepting pointers to // Python-allocated and -managed memory since we are accepting pointers to
// data members of python objects. We need to ensure that those objects // data members of python objects. We need to ensure that those objects
@ -107,4 +87,30 @@ BOOST_PYTHON_MODULE(ycm_core)
&ClangCompleter::UpdateTranslationUnitAsync ) &ClangCompleter::UpdateTranslationUnitAsync )
.def( "CandidatesForQueryAndLocationInFileAsync", .def( "CandidatesForQueryAndLocationInFileAsync",
&ClangCompleter::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
} }