diff --git a/cpp/ycm/Candidate.cpp b/cpp/ycm/Candidate.cpp index f50e9b08..2f925326 100644 --- a/cpp/ycm/Candidate.cpp +++ b/cpp/ycm/Candidate.cpp @@ -43,9 +43,9 @@ std::string GetWordBoundaryChars( const std::string &text ) { return result; } -LetterNode* FirstUppercaseNode( const std::list< LetterNode *> &list ) { +LetterNode *FirstUppercaseNode( const std::list< LetterNode *> &list ) { LetterNode *node = NULL; - foreach( LetterNode *current_node, list ) { + foreach( LetterNode * current_node, list ) { if ( current_node->LetterIsUppercase() ) { node = current_node; break; @@ -54,9 +54,9 @@ LetterNode* FirstUppercaseNode( const std::list< LetterNode *> &list ) { return node; } -LetterNode* FirstLowercaseNode( const std::list< LetterNode *> &list ) { +LetterNode *FirstLowercaseNode( const std::list< LetterNode *> &list ) { LetterNode *node = NULL; - foreach( LetterNode *current_node, list ) { + foreach( LetterNode * current_node, list ) { if ( !current_node->LetterIsUppercase() ) { node = current_node; break; diff --git a/cpp/ycm/ClangCompleter/ClangCompleter.cpp b/cpp/ycm/ClangCompleter/ClangCompleter.cpp index dea57866..7165e27f 100644 --- a/cpp/ycm/ClangCompleter/ClangCompleter.cpp +++ b/cpp/ycm/ClangCompleter/ClangCompleter.cpp @@ -269,12 +269,13 @@ void ClangCompleter::DeleteCachesForFileAsync( const std::string &filename ) { void ClangCompleter::DeleteCaches() { std::vector< std::string > filenames; + if ( !file_cache_delete_stack_.PopAllNoWait( filenames ) ) return; lock_guard< mutex > lock( filename_to_translation_unit_mutex_ ); - foreach( const std::string &filename, filenames ) { + foreach( const std::string & filename, filenames ) { filename_to_translation_unit_.erase( filename ); } } @@ -415,7 +416,7 @@ std::vector< CompletionData > ClangCompleter::SortCandidatesForQuery( std::vector< const Candidate * > repository_candidates = candidate_repository_.GetCandidatesForStrings( completion_datas ); - std::vector< ResultAnd< CompletionData* > > data_and_results; + std::vector< ResultAnd< CompletionData * > > data_and_results; for ( uint i = 0; i < repository_candidates.size(); ++i ) { const Candidate *candidate = repository_candidates[ i ]; @@ -427,8 +428,8 @@ std::vector< CompletionData > ClangCompleter::SortCandidatesForQuery( query_has_uppercase_letters ); if ( result.IsSubsequence() ) { - ResultAnd< CompletionData* > data_and_result( &completion_datas[ i ], - result ); + ResultAnd< CompletionData * > data_and_result( &completion_datas[ i ], + result ); data_and_results.push_back( boost::move( data_and_result ) ); } } @@ -438,7 +439,7 @@ std::vector< CompletionData > ClangCompleter::SortCandidatesForQuery( std::vector< CompletionData > sorted_completion_datas; sorted_completion_datas.reserve( data_and_results.size() ); - foreach ( const ResultAnd< CompletionData* > & data_and_result, + foreach ( const ResultAnd< CompletionData * > &data_and_result, data_and_results ) { sorted_completion_datas.push_back( *data_and_result.extra_object_ ); } diff --git a/cpp/ycm/IdentifierCompleter.cpp b/cpp/ycm/IdentifierCompleter.cpp index 50361925..346dd752 100644 --- a/cpp/ycm/IdentifierCompleter.cpp +++ b/cpp/ycm/IdentifierCompleter.cpp @@ -250,7 +250,7 @@ void IdentifierCompleter::ResultsForQueryAndType( continue; Result result = candidate->QueryMatchResult( - query, query_has_uppercase_letters ); + query, query_has_uppercase_letters ); if ( result.IsSubsequence() ) results.push_back( result ); diff --git a/cpp/ycm/Result.h b/cpp/ycm/Result.h index 262182f2..a9c6cab4 100644 --- a/cpp/ycm/Result.h +++ b/cpp/ycm/Result.h @@ -100,15 +100,15 @@ struct ResultAnd { }; template< class T > -struct ResultAnd { - ResultAnd( const T* extra_object, const Result &result ) +struct ResultAnd { + ResultAnd( const T *extra_object, const Result &result ) : extra_object_( extra_object ), result_( result ) {} bool operator< ( const ResultAnd &other ) const { return result_ < other.result_; } - const T* extra_object_; + const T *extra_object_; Result result_; };