Code style fixes

This commit is contained in:
Strahinja Val Markovic 2013-04-29 19:24:28 -07:00
parent f25bf2f6c8
commit 7f676f85ae
4 changed files with 32 additions and 28 deletions

View File

@ -69,9 +69,9 @@ std::vector< const Candidate * > CandidateRepository::GetCandidatesForStrings(
empty_; empty_;
const Candidate *&candidate = GetValueElseInsert( const Candidate *&candidate = GetValueElseInsert(
candidate_holder_, candidate_holder_,
validated_candidate_text, validated_candidate_text,
NULL ); NULL );
if ( !candidate ) if ( !candidate )
candidate = new Candidate( validated_candidate_text ); candidate = new Candidate( validated_candidate_text );

View File

@ -178,10 +178,10 @@ Future< void > ClangCompleter::UpdateTranslationUnitAsync(
std::vector< std::string > flags ) { std::vector< std::string > flags ) {
function< void() > functor = function< void() > functor =
boost::bind( &ClangCompleter::UpdateTranslationUnit, boost::bind( &ClangCompleter::UpdateTranslationUnit,
boost::ref( *this ), boost::ref( *this ),
boost::move( filename ), boost::move( filename ),
boost::move( unsaved_files ), boost::move( unsaved_files ),
boost::move( flags ) ); boost::move( flags ) );
shared_ptr< ClangPackagedTask > clang_packaged_task = shared_ptr< ClangPackagedTask > clang_packaged_task =
make_shared< ClangPackagedTask >(); make_shared< ClangPackagedTask >();
@ -272,9 +272,11 @@ Location ClangCompleter::GetDeclarationLocation(
filename, filename,
unsaved_files, unsaved_files,
flags ); flags );
if (!unit) {
if ( !unit ) {
return Location(); return Location();
} }
return unit->GetDeclarationLocation( line, column, unsaved_files ); return unit->GetDeclarationLocation( line, column, unsaved_files );
} }
@ -289,9 +291,11 @@ Location ClangCompleter::GetDefinitionLocation(
filename, filename,
unsaved_files, unsaved_files,
flags ); flags );
if (!unit) {
if ( !unit ) {
return Location(); return Location();
} }
return unit->GetDefinitionLocation( line, column, unsaved_files ); return unit->GetDefinitionLocation( line, column, unsaved_files );
} }
@ -340,19 +344,19 @@ void ClangCompleter::CreateSortingTask(
function< CompletionDatas( const CompletionDatas & ) > function< CompletionDatas( const CompletionDatas & ) >
sort_candidates_for_query_functor = sort_candidates_for_query_functor =
boost::bind( &ClangCompleter::SortCandidatesForQuery, boost::bind( &ClangCompleter::SortCandidatesForQuery,
boost::ref( *this ), boost::ref( *this ),
query, query,
_1 ); _1 );
function< CompletionDatas() > operate_on_completion_data_functor = function< CompletionDatas() > operate_on_completion_data_functor =
boost::bind( &ClangResultsCache::OperateOnCompletionDatas< CompletionDatas >, boost::bind( &ClangResultsCache::OperateOnCompletionDatas< CompletionDatas >,
boost::cref( latest_clang_results_ ), boost::cref( latest_clang_results_ ),
boost::move( sort_candidates_for_query_functor ) ); boost::move( sort_candidates_for_query_functor ) );
shared_ptr< packaged_task< AsyncCompletions > > task = shared_ptr< packaged_task< AsyncCompletions > > task =
boost::make_shared< packaged_task< AsyncCompletions > >( boost::make_shared< packaged_task< AsyncCompletions > >(
boost::bind( ReturnValueAsShared< std::vector< CompletionData > >, boost::bind( ReturnValueAsShared< std::vector< CompletionData > >,
boost::move( operate_on_completion_data_functor ) ) ); boost::move( operate_on_completion_data_functor ) ) );
future = task->get_future(); future = task->get_future();
sorting_task_.Set( task ); sorting_task_.Set( task );
@ -369,12 +373,12 @@ void ClangCompleter::CreateClangTask(
function< CompletionDatas() > candidates_for_location_functor = function< CompletionDatas() > candidates_for_location_functor =
boost::bind( &ClangCompleter::CandidatesForLocationInFile, boost::bind( &ClangCompleter::CandidatesForLocationInFile,
boost::ref( *this ), boost::ref( *this ),
boost::move( filename ), boost::move( filename ),
line, line,
column, column,
boost::move( unsaved_files ), boost::move( unsaved_files ),
boost::move( flags ) ); boost::move( flags ) );
shared_ptr< ClangPackagedTask > clang_packaged_task = shared_ptr< ClangPackagedTask > clang_packaged_task =
make_shared< ClangPackagedTask >(); make_shared< ClangPackagedTask >();
@ -382,7 +386,7 @@ void ClangCompleter::CreateClangTask(
clang_packaged_task->completions_task_ = clang_packaged_task->completions_task_ =
packaged_task< AsyncCompletions >( packaged_task< AsyncCompletions >(
boost::bind( ReturnValueAsShared< std::vector< CompletionData > >, boost::bind( ReturnValueAsShared< std::vector< CompletionData > >,
boost::move( candidates_for_location_functor ) ) ); boost::move( candidates_for_location_functor ) ) );
clang_task_.Set( clang_packaged_task ); clang_task_.Set( clang_packaged_task );
} }

View File

@ -130,8 +130,8 @@ CompilationDatabase::GetCompilationInfoForFileAsync(
function< CompilationInfoForFile() > functor = function< CompilationInfoForFile() > functor =
boost::bind( &CompilationDatabase::GetCompilationInfoForFile, boost::bind( &CompilationDatabase::GetCompilationInfoForFile,
boost::ref( *this ), boost::ref( *this ),
path_to_file ); path_to_file );
InfoTask task = InfoTask task =
make_shared< packaged_task< AsyncCompilationInfoForFile > >( make_shared< packaged_task< AsyncCompilationInfoForFile > >(

View File

@ -27,8 +27,8 @@ TEST( CandidateRepositoryTest, EmptyCandidatesForUnicode ) {
inputs.push_back( "fooδιακριτικός" ); inputs.push_back( "fooδιακριτικός" );
inputs.push_back( "fooδιακός" ); inputs.push_back( "fooδιακός" );
CandidateRepository& repo = CandidateRepository::Instance(); CandidateRepository &repo = CandidateRepository::Instance();
std::vector< const Candidate* > candidates = std::vector< const Candidate * > candidates =
repo.GetCandidatesForStrings( inputs ); repo.GetCandidatesForStrings( inputs );
EXPECT_EQ( "", candidates[ 0 ]->Text() ); EXPECT_EQ( "", candidates[ 0 ]->Text() );
@ -40,8 +40,8 @@ TEST( CandidateRepositoryTest, EmptyCandidatesForNonPrintable ) {
std::vector< std::string > inputs; std::vector< std::string > inputs;
inputs.push_back( "\x01\x05\x0a\x15" ); inputs.push_back( "\x01\x05\x0a\x15" );
CandidateRepository& repo = CandidateRepository::Instance(); CandidateRepository &repo = CandidateRepository::Instance();
std::vector< const Candidate* > candidates = std::vector< const Candidate * > candidates =
repo.GetCandidatesForStrings( inputs ); repo.GetCandidatesForStrings( inputs );
EXPECT_EQ( "", candidates[ 0 ]->Text() ); EXPECT_EQ( "", candidates[ 0 ]->Text() );