Commit 25ea0d9d authored by Onur Aslan's avatar Onur Aslan

Imported Upstream version 0+20131009+gitcbb43ba

parent c5ea7d7a
......@@ -44,24 +44,14 @@ Here are the things you should do when creating an issue:
1. **Write a step-by-step procedure that when performed repeatedly reproduces
your issue.** If we can't reproduce the issue, then we can't fix it. It's
that simple.
2. Put the following options in your vimrc:
```viml
let g:ycm_server_use_vim_stdout = 1
let g:ycm_server_log_level = 'debug'
```
Then start gvim/macvim (not console vim) from the console. As you use Vim,
you'll see the `ycmd` debug output stream in the console. Attach that to you
issue.
3. **Create a test case for your issue**. This is critical. Don't talk about how
2. **Create a test case for your issue**. This is critical. Don't talk about how
"when I have X in my file" or similar, _create a file with X in it_ and put
the contents inside code blocks in your issue description. Try to make this
test file _as small as possible_. Don't just paste a huge, 500 line source
file you were editing and present that as a test. _Minimize_ the file so that
the problem is reproduced with the smallest possible amount of test data.
4. **Include your OS and OS version.**
5. **Include the output of `vim --version`.**
3. **Include your OS and OS version.**
4. **Include the output of `vim --version`.**
Creating good pull requests
......
......@@ -89,9 +89,8 @@ local binary folder (for example `/usr/local/bin/mvim`) and then symlink it:
Install YouCompleteMe with [Vundle][].
**Remember:** YCM is a plugin with a compiled component. If you **update** YCM
using Vundle and the ycm_support_libs library APIs have changed (happens
rarely), YCM will notify you to recompile it. You should then rerun the install
process.
using Vundle and the ycm_core library API has changed (happens rarely), YCM will
notify you to recompile it. You should then rerun the install process.
It's recommended that you have the latest Xcode installed along with the latest
Command Line Tools (that you install from within Xcode).
......@@ -137,9 +136,8 @@ from source][vim-build] (don't worry, it's easy).
Install YouCompleteMe with [Vundle][].
**Remember:** YCM is a plugin with a compiled component. If you **update** YCM
using Vundle and the ycm_support_libs library APIs have changed (happens
rarely), YCM will notify you to recompile it. You should then rerun the install
process.
using Vundle and the ycm_core library API has changed (happens rarely), YCM will
notify you to recompile it. You should then rerun the install process.
Install development tools and CMake: `sudo apt-get install build-essential cmake`
......@@ -186,9 +184,8 @@ that platform).
See the _FAQ_ if you have any issues.
**Remember:** YCM is a plugin with a compiled component. If you **update** YCM
using Vundle and the ycm_support_libs library APIs have changed (happens
rarely), YCM will notify you to recompile it. You should then rerun the install
process.
using Vundle and the ycm_core library API has changed (happens rarely), YCM will
notify you to recompile it. You should then rerun the install process.
**Please follow the instructions carefully. Read EVERY WORD.**
......@@ -210,10 +207,6 @@ process.
idea). With Vundle, this would mean adding a `Bundle
'Valloric/YouCompleteMe'` line to your [vimrc][].
If you don't install YCM with Vundle, make sure you have run
`git submodule update --init --recursive` after checking out the YCM
repository (Vundle will do this for you) to fetch YCM's dependencies.
3. [Complete this step ONLY if you care about semantic completion support for
C-family languages. Otherwise it's not neccessary.]
......@@ -228,8 +221,8 @@ process.
binaries from llvm.org][clang-download] if at all possible. Make sure you
download the correct archive file for your OS.
4. **Compile the `ycm_support_libs` libraries** that YCM needs. These libs
are the C++ engines that YCM uses to get fast completions.
4. **Compile the `ycm_core` plugin plugin** (ha!) that YCM needs. This is the
C++ engine that YCM uses to get fast completions.
You will need to have `cmake` installed in order to generate the required
makefiles. Linux users can install cmake with their package manager (`sudo
......@@ -268,7 +261,7 @@ process.
Now that makefiles have been generated, simply run:
make ycm_support_libs
make ycm_core
For those who want to use the system version of libclang, you would pass
`-DUSE_SYSTEM_LIBCLANG=ON` to cmake _instead of_ the
......@@ -330,13 +323,6 @@ YCM automatically detects which completion engine would be the best in any
situation. On occasion, it queries several of them at once, merges the
outputs and presents the results to you.
### Client-server architecture
YCM has a client-server architecture; the Vim part of YCM is only a thin client
that talks to the `ycmd` HTTP+JSON server that has the vast majority of YCM
logic and functionality. The server is started and stopped automatically as you
start and stop Vim.
### Completion string ranking
The subsequence filter removes any completions that do not match the input, but
......@@ -512,11 +498,6 @@ yours truly.
Commands
--------
### The `:YcmRestartServer` command
If the `ycmd` completion server suddenly stops for some reason, you can restart
it with this command.
### The `:YcmForceCompileAndDiagnostics` command
Calling this command will force YCM to immediately recompile your file
......@@ -717,16 +698,13 @@ is used like a hash set, meaning that only the keys matter).
See the `g:ycm_filetype_whitelist` option for more details on how this works.
Default: `[see next line]`
Default: `{'notes': 1, 'markdown': 1, 'text': 1}`
let g:ycm_filetype_blacklist = {
\ 'tagbar' : 1,
\ 'qf' : 1,
\ 'notes' : 1,
\ 'markdown' : 1,
\ 'unite' : 1,
\ 'text' : 1,
\ 'vimwiki' : 1,
\ 'unite' : 1,
\}
### The `g:ycm_filetype_specific_completion_to_disable` option
......@@ -854,99 +832,6 @@ Default: `0`
let g:ycm_seed_identifiers_with_syntax = 0
### The `g:ycm_extra_conf_vim_data` option
If you're using semantic completion for C-family files, this option might come
handy; it's a way of sending data from Vim to your `FlagsForFile` function in
your `.ycm_extra_conf.py` file.
This option is supposed to be a list of VimScript expression strings that are
evaluated for every request to the `ycmd` server and then passed to your
`FlagsForFile` function as a `client_data` keyword argument.
For instance, if you set this option to `['v:version']`, your `FlagsForFile`
function will be called like this:
```python
# The '704' value is of course contingent on Vim 7.4; in 7.3 it would be '703'
FlagsForFile(filename, client_data = {'v:version': 704})
```
So the `client_data` parameter is a dictionary mapping Vim expression strings to
their values at the time of the request.
The correct way to define parameters for your `FlagsForFile` function:
```python
def FlagsForFile(filename, **kwargs):
```
You can then get to `client_data` with `kwargs['client_data']`.
Default: `[]`
let g:ycm_extra_conf_vim_data = []
### The `g:ycm_server_use_vim_stdout` option
By default, the `ycmd` completion server writes logs to logfiles. When this
option is set to `1`, the server writes logs to Vim's stdout (so you'll see them
in the console).
Default: `0`
let g:ycm_server_use_vim_stdout = 0
### The `g:ycm_server_keep_logfiles` option
When this option is set to `1`, the `ycmd` completion server will keep the
logfiles around after shutting down (they are deleted on shutdown by default).
To see where the logfiles are, call `:YcmDebugInfo`.
Default: `0`
let g:ycm_server_keep_logfiles = 0
### The `g:ycm_server_log_level` option
The logging level that the `ycmd` completion server uses. Valid values are the
following, from most verbose to least verbose:
- `debug`
- `info`
- `warning`
- `error`
- `critical`
Note that `debug` is _very_ verbose.
Default: `info`
let g:ycm_server_log_level = 'info'
### The `g:ycm_server_idle_suicide_seconds` option
This option sets the number of seconds of `ycmd` server idleness (no requests
received) after which the server stops itself. NOTE: the YCM Vim client sends a
shutdown request to the server when Vim is shutting down.
If your Vim crashes for instance, `ycmd` never gets the shutdown command and
becomes a zombie process. This option prevents such zombies from sticking around
forever.
The default option is `43200` seconds which is 12 hours. The reason for the
interval being this long is to prevent the server from shutting down if you
leave your computer (and Vim) turned on during the night.
A setting of `0` turns off the timer.
The server "heartbeat" that checks whether this interval has passed occurs every
10 minutes.
Default: `43200`
let g:ycm_server_idle_suicide_seconds = 43200
### The `g:ycm_csharp_server_port` option
The port number (on `localhost`) on which the OmniSharp server should be
......@@ -1200,20 +1085,6 @@ Default: `1`
FAQ
---
### I used to be able to `import vim` in `.ycm_extra_conf.py`, but now can't
YCM was rewritten to use a client-server architecture where most of the logic is
in the `ycmd` server. So the magic `vim` module you could have previously
imported in your `.ycm_extra_conf.py` files doesn't exist anymore.
To be fair, importing the magic `vim` module in extra conf files was never
supported in the first place; it only ever worked by accident and was never a
part of the extra conf API.
But fear not, you should be able to tweak your extra conf files to continue
working by using the `g:ycm_extra_conf_vim_data` option. See the docs on that
option for details.
### I get a linker warning regarding `libpython` on Mac when compiling YCM
If the warning is `ld: warning: path '/usr/lib/libpython2.7.dylib' following -L
......
This diff is collapsed.
......@@ -138,18 +138,19 @@ endif()
# the compiler to output a warning during linking:
# clang: warning: argument unused during compilation: '-std=c++0x'
# This is caused by cmake passing this flag to the linking stage which it
# shouldn't do. It's ignored so it does no harm, but the warning is annoying.
#
# Putting the flag in add_definitions() works around the issue, even though it
# shouldn't in theory go there.
# shouldn't do. It's ignored so it does no harm, but the warning is annoying and
# there's no way around the problem (the flag is correctly used during the
# compilation stage). We could use add_definitions(-std=c++0x), but this will
# break the llvm build since the flag will then be used when compiling C code
# too. Sadly there's no way around the warning.
if ( CPP11_AVAILABLE )
message( "Your C++ compiler supports C++11, compiling in that mode." )
# Cygwin needs its hand held a bit; see issue #473
if ( CYGWIN AND CMAKE_COMPILER_IS_GNUCXX )
add_definitions( -std=gnu++0x )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++0x" )
else()
add_definitions( -std=c++0x )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x" )
endif()
else()
message(
......
......@@ -43,8 +43,6 @@ flags = [
'-Wno-variadic-macros',
'-fexceptions',
'-DNDEBUG',
# You 100% do NOT need -DUSE_CLANG_COMPLETER in your flags; only the YCM
# source code needs it.
'-DUSE_CLANG_COMPLETER',
# THIS IS IMPORTANT! Without a "-std=<something>" flag, clang won't know which
# language to use when compiling headers. So it will guess. Badly. So C++
......@@ -130,7 +128,7 @@ def MakeRelativePathsInFlagsAbsolute( flags, working_directory ):
return new_flags
def FlagsForFile( filename, **kwargs ):
def FlagsForFile( filename ):
if database:
# Bear in mind that compilation_info.compiler_flags_ does NOT return a
# python list, but a "list-like" StringVec object
......
......@@ -17,12 +17,10 @@
cmake_minimum_required( VERSION 2.8 )
project( ycm_support_libs )
set( CLIENT_LIB "ycm_client_support" )
set( SERVER_LIB "ycm_core" )
project( ycm_core )
set( Python_ADDITIONAL_VERSIONS 2.7 2.6 )
find_package( PythonLibs 2.6 REQUIRED )
set( Python_ADDITIONAL_VERSIONS 2.7 2.6 2.5 )
find_package( PythonLibs 2.5 REQUIRED )
if ( NOT PYTHONLIBS_VERSION_STRING VERSION_LESS "3.0.0" )
message( FATAL_ERROR
......@@ -140,15 +138,15 @@ include_directories(
${CLANG_INCLUDES_DIR}
)
file( GLOB_RECURSE SERVER_SOURCES *.h *.cpp )
file( GLOB_RECURSE SOURCES *.h *.cpp )
# The test sources are a part of a different target, so we remove them
# The CMakeFiles cpp file is picked up when the user creates an in-source build,
# and we don't want that. We also remove client-specific code
file( GLOB_RECURSE to_remove tests/*.h tests/*.cpp CMakeFiles/*.cpp *client* )
# and we don't want that.
file( GLOB_RECURSE to_remove tests/*.h tests/*.cpp CMakeFiles/*.cpp )
if( to_remove )
list( REMOVE_ITEM SERVER_SOURCES ${to_remove} )
list( REMOVE_ITEM SOURCES ${to_remove} )
endif()
if ( USE_CLANG_COMPLETER )
......@@ -160,7 +158,7 @@ else()
file( GLOB_RECURSE to_remove_clang ClangCompleter/*.h ClangCompleter/*.cpp )
if( to_remove_clang )
list( REMOVE_ITEM SERVER_SOURCES ${to_remove_clang} )
list( REMOVE_ITEM SOURCES ${to_remove_clang} )
endif()
endif()
......@@ -189,8 +187,7 @@ if ( EXTERNAL_LIBCLANG_PATH OR USE_SYSTEM_LIBCLANG )
PATHS
${ENV_LIB_PATHS}
/usr/lib
/usr/lib/llvm
/Library/Developer/CommandLineTools/usr/lib )
/usr/lib/llvm )
set( EXTERNAL_LIBCLANG_PATH ${TEMP} )
else()
# For Macs, we do things differently; look further in this file.
......@@ -220,33 +217,11 @@ endif()
#############################################################################
# We don't actually need all of the files this picks up, just the ones needed by
# PythonSupport.cpp. But this is easier to maintain and dead code elemination
# will remove unused code.
file( GLOB CLIENT_SOURCES *.h *.cpp )
file( GLOB SERVER_SPECIFIC *ycm_core* )
if( SERVER_SPECIFIC )
list( REMOVE_ITEM CLIENT_SOURCES ${SERVER_SPECIFIC} )
endif()
add_library( ${CLIENT_LIB} SHARED
${CLIENT_SOURCES}
add_library( ${PROJECT_NAME} SHARED
${SOURCES}
)
target_link_libraries( ${CLIENT_LIB}
BoostParts
${PYTHON_LIBRARIES}
${EXTRA_LIBS}
)
#############################################################################
add_library( ${SERVER_LIB} SHARED
${SERVER_SOURCES}
)
target_link_libraries( ${SERVER_LIB}
target_link_libraries( ${PROJECT_NAME}
BoostParts
${PYTHON_LIBRARIES}
${LIBCLANG_TARGET}
......@@ -256,43 +231,35 @@ target_link_libraries( ${SERVER_LIB}
if( LIBCLANG_TARGET )
if( NOT WIN32 )
add_custom_command(
TARGET ${SERVER_LIB}
TARGET ${PROJECT_NAME}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy "${LIBCLANG_TARGET}" "$<TARGET_FILE_DIR:${SERVER_LIB}>"
COMMAND ${CMAKE_COMMAND} -E copy "${LIBCLANG_TARGET}" "$<TARGET_FILE_DIR:${PROJECT_NAME}>"
)
else()
add_custom_command(
TARGET ${SERVER_LIB}
TARGET ${PROJECT_NAME}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy "${PATH_TO_LLVM_ROOT}/bin/libclang.dll" "$<TARGET_FILE_DIR:${SERVER_LIB}>")
COMMAND ${CMAKE_COMMAND} -E copy "${PATH_TO_LLVM_ROOT}/bin/libclang.dll" "$<TARGET_FILE_DIR:${PROJECT_NAME}>")
endif()
endif()
#############################################################################
# Convenience target that builds both support libs.
add_custom_target( ${PROJECT_NAME}
DEPENDS ${CLIENT_LIB} ${SERVER_LIB} )
#############################################################################
# Things are a bit different on Macs when using an external libclang.dylib; here
# we want to make sure we use @loader_path/libclang.dylib instead of
# @rpath/libclang.dylib in the final ycm_core.so. If we use the
# @rpath version, then it may load the system libclang which the user
# explicitely does not want (otherwise the user would specify
# USE_SYSTEM_LIBCLANG). With @loader_path, we make sure that only the
# libclang.dylib present in the same directory as our ycm_core.so
# is used.
# @rpath/libclang.dylib in the final ycm_core.so. If we use the @rpath version,
# then it may load the system libclang which the user explicitely does not want
# (otherwise the user would specify USE_SYSTEM_LIBCLANG). With @loader_path, we
# make sure that only the libclang.dylib present in the same directory as our
# ycm_core.so is used.
if ( EXTERNAL_LIBCLANG_PATH AND APPLE )
add_custom_command( TARGET ${SERVER_LIB}
add_custom_command( TARGET ${PROJECT_NAME}
POST_BUILD
COMMAND install_name_tool
"-change"
"@rpath/libclang.dylib"
"@loader_path/libclang.dylib"
"$<TARGET_FILE:${SERVER_LIB}>"
"$<TARGET_FILE:${PROJECT_NAME}>"
)
endif()
......@@ -301,24 +268,19 @@ endif()
# We don't want the "lib" prefix, it can screw up python when it tries to search
# for our module
set_target_properties( ${CLIENT_LIB} PROPERTIES PREFIX "")
set_target_properties( ${SERVER_LIB} PROPERTIES PREFIX "")
set_target_properties( ${PROJECT_NAME} PROPERTIES PREFIX "")
if ( WIN32 OR CYGWIN )
# This is the extension for compiled Python modules on Windows
set_target_properties( ${CLIENT_LIB} PROPERTIES SUFFIX ".pyd")
set_target_properties( ${SERVER_LIB} PROPERTIES SUFFIX ".pyd")
set_target_properties( ${PROJECT_NAME} PROPERTIES SUFFIX ".pyd")
else()
# Even on macs, we want a .so extension instead of a .dylib which is what
# cmake would give us by default. Python won't recognize a .dylib as a module,
# but it will recognize a .so
set_target_properties( ${CLIENT_LIB} PROPERTIES SUFFIX ".so")
set_target_properties( ${SERVER_LIB} PROPERTIES SUFFIX ".so")
set_target_properties( ${PROJECT_NAME} PROPERTIES SUFFIX ".so")
endif()
set_target_properties( ${CLIENT_LIB} PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/../../python )
set_target_properties( ${SERVER_LIB} PROPERTIES
set_target_properties( ${PROJECT_NAME} PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/../../python )
#############################################################################
......
This diff is collapsed.
......@@ -18,11 +18,18 @@
#ifndef CLANGCOMPLETE_H_WLKDU0ZV
#define CLANGCOMPLETE_H_WLKDU0ZV
#include "ConcurrentLatestValue.h"
#include "ConcurrentStack.h"
#include "Future.h"
#include "UnsavedFile.h"
#include "Diagnostic.h"
#include "ClangResultsCache.h"
#include "TranslationUnitStore.h"
#include <boost/utility.hpp>
#include <boost/thread/future.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/unordered_map.hpp>
#include <string>
......@@ -30,26 +37,46 @@ typedef struct CXTranslationUnitImpl *CXTranslationUnit;
namespace YouCompleteMe {
class CandidateRepository;
class TranslationUnit;
struct CompletionData;
struct Location;
typedef std::vector< CompletionData > CompletionDatas;
typedef boost::shared_ptr< CompletionDatas > AsyncCompletions;
// All filename parameters must be absolute paths.
typedef boost::unordered_map < std::string,
boost::shared_ptr <
std::vector< std::string > > > FlagsForFile;
// TODO: document that all filename parameters must be absolute paths
class ClangCompleter : boost::noncopyable {
public:
ClangCompleter();
~ClangCompleter();
void EnableThreading();
std::vector< Diagnostic > DiagnosticsForFile( const std::string &filename );
bool UpdatingTranslationUnit( const std::string &filename );
std::vector< Diagnostic > UpdateTranslationUnit(
// Public because of unit tests (gtest is not very thread-friendly)
void UpdateTranslationUnit(
const std::string &filename,
const std::vector< UnsavedFile > &unsaved_files,
const std::vector< std::string > &flags );
// NOTE: params are taken by value on purpose! With a C++11 compiler we can
// avoid internal copies if params are taken by value (move ctors FTW)
Future< void > UpdateTranslationUnitAsync(
std::string filename,
std::vector< UnsavedFile > unsaved_files,
std::vector< std::string > flags );
// Public because of unit tests (gtest is not very thread-friendly)
std::vector< CompletionData > CandidatesForLocationInFile(
const std::string &filename,
int line,
......@@ -57,6 +84,14 @@ public:
const std::vector< UnsavedFile > &unsaved_files,
const std::vector< std::string > &flags );
Future< AsyncCompletions > CandidatesForQueryAndLocationInFileAsync(
const std::string &query,
const std::string &filename,
int line,
int column,
const std::vector< UnsavedFile > &unsaved_files,
const std::vector< std::string > &flags );
Location GetDeclarationLocation(
const std::string &filename,
int line,
......@@ -71,10 +106,55 @@ public:
const std::vector< UnsavedFile > &unsaved_files,
const std::vector< std::string > &flags );
void DeleteCachesForFile( const std::string &filename );
void DeleteCachesForFileAsync( const std::string &filename );
private:
void DeleteCaches();
// This is basically a union. Only one of the two tasks is set to something
// valid, the other task is invalid. Which one is valid depends on the caller.
struct ClangPackagedTask {
boost::packaged_task< AsyncCompletions > completions_task_;
boost::packaged_task< void > parsing_task_;
};
typedef ConcurrentLatestValue <
boost::shared_ptr <
boost::packaged_task< AsyncCompletions > > > LatestSortingTask;
typedef ConcurrentLatestValue <
boost::shared_ptr< ClangPackagedTask > > LatestClangTask;
typedef ConcurrentStack< std::string > FileCacheDeleteStack;
bool ShouldSkipClangResultCache( const std::string &query,
int line,
int column );
void CreateSortingTask( const std::string &query,
boost::unique_future< AsyncCompletions > &future );
// NOTE: params are taken by value on purpose! With a C++11 compiler we can
// avoid internal copies if params are taken by value (move ctors FTW)
void CreateClangTask(
std::string filename,
int line,
int column,
std::vector< UnsavedFile > unsaved_files,
std::vector< std::string > flags );
std::vector< CompletionData > SortCandidatesForQuery(
const std::string &query,
const std::vector< CompletionData > &completion_datas );
void InitThreads();
void ClangThreadMain();
void SortingThreadMain();
/////////////////////////////
// PRIVATE MEMBER VARIABLES
/////////////////////////////
......@@ -82,6 +162,35 @@ private:
CXIndex clang_index_;
TranslationUnitStore translation_unit_store_;
CandidateRepository &candidate_repository_;
bool threading_enabled_;
// TODO: use boost.atomic for time_to_die_
bool time_to_die_;
boost::shared_mutex time_to_die_mutex_;
// TODO: use boost.atomic for clang_data_ready_
bool clang_data_ready_;
boost::mutex clang_data_ready_mutex_;
boost::condition_variable clang_data_ready_condition_variable_;
ClangResultsCache latest_clang_results_;
FileCacheDeleteStack file_cache_delete_stack_;
// Unfortunately clang is not thread-safe so we need to be careful when we
// access it. Only one thread at a time is allowed to access any single
// translation unit. Currently we only use one thread to access clang and that
// is the thread represented by clang_thread_.
boost::scoped_ptr< boost::thread > clang_thread_;
boost::thread_group sorting_threads_;
mutable LatestClangTask clang_task_;
mutable LatestSortingTask sorting_task_;
};
} // namespace YouCompleteMe
......
// Copyright (C) 2013 Strahinja Val Markovic <val@markovic.io>
// Copyright (C) 2011, 2012 Strahinja Val Markovic <val@markovic.io>
//
// This file is part of YouCompleteMe.
//
......@@ -15,28 +15,29 @@
// You should have received a copy of the GNU General Public License
// along with YouCompleteMe. If not, see <http://www.gnu.org/licenses/>.
#ifndef RELEASEGIL_H_RDIEBSQ1
#define RELEASEGIL_H_RDIEBSQ1
#include "ClangResultsCache.h"
#include "standard.h"
#include <boost/python.hpp>
using boost::shared_mutex;
using boost::shared_lock;
using boost::unique_lock;
namespace YouCompleteMe {
class ReleaseGil {
public:
ReleaseGil() {
thread_state_ = PyEval_SaveThread();
}
bool ClangResultsCache::NewPositionDifferentFromStoredPosition( int new_line,
int new_colum )
const {
shared_lock< shared_mutex > reader_lock( access_mutex_ );
return line_ != new_line || column_ != new_colum;
}
~ReleaseGil() {
PyEval_RestoreThread( thread_state_ );
}
void ClangResultsCache::ResetWithNewLineAndColumn( int new_line,
int new_colum ) {
unique_lock< shared_mutex > reader_lock( access_mutex_ );
private:
PyThreadState *thread_state_;
};
line_ = new_line;
column_ = new_colum;
completion_datas_.clear();
}
} // namespace YouCompleteMe
#endif /* end of include guard: RELEASEGIL_H_RDIEBSQ1 */
// Copyright (C) 2011, 2012 Strahinja Val Markovic <val@markovic.io>
//
// This file is part of YouCompleteMe.
//
// YouCompleteMe is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// YouCompleteMe is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//