Running style_format.sh on codebase

This commit is contained in:
Strahinja Val Markovic 2013-10-29 19:13:52 -07:00
parent bff2584ec1
commit 227cceae8a
8 changed files with 75 additions and 72 deletions

View File

@ -93,6 +93,7 @@ std::vector< Diagnostic > ClangCompleter::UpdateTranslationUnit(
// parsed in the TU constructor // parsed in the TU constructor
if ( !translation_unit_created ) if ( !translation_unit_created )
return unit->Reparse( unsaved_files ); return unit->Reparse( unsaved_files );
return unit->LatestDiagnostics(); return unit->LatestDiagnostics();
} }

View File

@ -64,7 +64,7 @@ TranslationUnit::TranslationUnit(
filename.c_str(), filename.c_str(),
&pointer_flags[ 0 ], &pointer_flags[ 0 ],
pointer_flags.size(), pointer_flags.size(),
const_cast<CXUnsavedFile *>(unsaved), const_cast<CXUnsavedFile *>( unsaved ),
cxunsaved_files.size(), cxunsaved_files.size(),
clang_defaultEditingTranslationUnitOptions() ); clang_defaultEditingTranslationUnitOptions() );
@ -163,7 +163,7 @@ std::vector< CompletionData > TranslationUnit::CandidatesForLocation(
filename_.c_str(), filename_.c_str(),
line, line,
column, column,
const_cast<CXUnsavedFile *>(unsaved), const_cast<CXUnsavedFile *>( unsaved ),
cxunsaved_files.size(), cxunsaved_files.size(),
clang_defaultCodeCompleteOptions() ), clang_defaultCodeCompleteOptions() ),
clang_disposeCodeCompleteResults ); clang_disposeCodeCompleteResults );
@ -242,6 +242,7 @@ void TranslationUnit::Reparse( std::vector< CXUnsavedFile > &unsaved_files,
if ( !clang_translation_unit_ ) if ( !clang_translation_unit_ )
return; return;
CXUnsavedFile *unsaved = unsaved_files.size() > 0 CXUnsavedFile *unsaved = unsaved_files.size() > 0
? &unsaved_files[ 0 ] : NULL; ? &unsaved_files[ 0 ] : NULL;

View File

@ -67,10 +67,10 @@ private:
boost::shared_ptr< TranslationUnit > GetNoLock( const std::string &filename ); boost::shared_ptr< TranslationUnit > GetNoLock( const std::string &filename );
typedef boost::unordered_map< std::string, typedef boost::unordered_map < std::string,
boost::shared_ptr< TranslationUnit > > TranslationUnitForFilename; boost::shared_ptr< TranslationUnit > > TranslationUnitForFilename;
typedef boost::unordered_map< std::string, typedef boost::unordered_map < std::string,
std::size_t > FlagsHashForFilename; std::size_t > FlagsHashForFilename;
CXIndex clang_index_; CXIndex clang_index_;

View File

@ -30,7 +30,7 @@ namespace fs = boost::filesystem;
namespace { namespace {
const char * const COMMENT_AND_STRING_REGEX = const char *const COMMENT_AND_STRING_REGEX =
"//.*?$" // Anything following '//' "//.*?$" // Anything following '//'
"|" "|"
"#.*?$" // Anything following '#' "#.*?$" // Anything following '#'
@ -50,12 +50,12 @@ const char * const COMMENT_AND_STRING_REGEX =
// 3. the escaped double quote inside the string // 3. the escaped double quote inside the string
"(?<!\\\\)\"(?:\\\\\\\\|\\\\\"|.)*?\""; "(?<!\\\\)\"(?:\\\\\\\\|\\\\\"|.)*?\"";
const char * const IDENTIFIER_REGEX = "[_a-zA-Z]\\w*"; const char *const IDENTIFIER_REGEX = "[_a-zA-Z]\\w*";
// For details on the tag format supported, see here for details: // For details on the tag format supported, see here for details:
// http://ctags.sourceforge.net/FORMAT // http://ctags.sourceforge.net/FORMAT
// TL;DR: The only supported format is the one Exuberant Ctags emits. // TL;DR: The only supported format is the one Exuberant Ctags emits.
const char * const TAG_REGEX = const char *const TAG_REGEX =
"^([^\\t\\n\\r]+)" // The first field is the identifier "^([^\\t\\n\\r]+)" // The first field is the identifier
"\\t" // A TAB char is the field separator "\\t" // A TAB char is the field separator
// The second field is the path to the file that has the identifier; either // The second field is the path to the file that has the identifier; either
@ -71,8 +71,7 @@ const char * const TAG_REGEX =
// When passed a const char* this will create a temporary std::string for // When passed a const char* this will create a temporary std::string for
// comparison, but it's fast enough for our use case. // comparison, but it's fast enough for our use case.
struct StringEqualityComparer : struct StringEqualityComparer :
std::binary_function< std::string, std::string, bool > std::binary_function< std::string, std::string, bool > {
{
bool operator()( const std::string &a, const std::string &b ) const { bool operator()( const std::string &a, const std::string &b ) const {
return a == b; return a == b;
} }
@ -84,8 +83,8 @@ struct StringEqualityComparer :
// :e $VIMRUNTIME/filetype.vim // :e $VIMRUNTIME/filetype.vim
// This is a map of const char* and not std::string to prevent issues with // This is a map of const char* and not std::string to prevent issues with
// static initialization. // static initialization.
const boost::unordered_map< const char*, const boost::unordered_map < const char *,
const char*, const char *,
boost::hash< std::string >, boost::hash< std::string >,
StringEqualityComparer > LANG_TO_FILETYPE = StringEqualityComparer > LANG_TO_FILETYPE =
boost::assign::map_list_of boost::assign::map_list_of
@ -128,7 +127,7 @@ const boost::unordered_map< const char*,
( "Vim" , "vim" ) ( "Vim" , "vim" )
( "YACC" , "yacc" ); ( "YACC" , "yacc" );
const char * const NOT_FOUND = "YCMFOOBAR_NOT_FOUND"; const char *const NOT_FOUND = "YCMFOOBAR_NOT_FOUND";
} // unnamed namespace } // unnamed namespace

View File

@ -40,8 +40,10 @@ namespace {
std::string GetUtf8String( const boost::python::object &string_or_unicode ) { std::string GetUtf8String( const boost::python::object &string_or_unicode ) {
extract< std::string > to_string( string_or_unicode ); extract< std::string > to_string( string_or_unicode );
if ( to_string.check() ) if ( to_string.check() )
return to_string(); return to_string();
return extract< std::string >( str( string_or_unicode ).encode( "utf8" ) ); return extract< std::string >( str( string_or_unicode ).encode( "utf8" ) );
} }

View File

@ -7,7 +7,7 @@ int main( int argc, char **argv ) {
// Necessary because of usage of the ReleaseGil class // Necessary because of usage of the ReleaseGil class
PyEval_InitThreads(); PyEval_InitThreads();
testing::InitGoogleMock(&argc, argv); testing::InitGoogleMock( &argc, argv );
return RUN_ALL_TESTS(); return RUN_ALL_TESTS();
} }