From 04991d874d2e38ea7f21d775ccf4ca3ac46b30af Mon Sep 17 00:00:00 2001 From: Strahinja Val Markovic Date: Wed, 5 Sep 2012 21:49:51 -0700 Subject: [PATCH] Moving a comment closer to the related code --- python/completers/cpp/clang_completer.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/python/completers/cpp/clang_completer.py b/python/completers/cpp/clang_completer.py index cc02ab04..f4855284 100644 --- a/python/completers/cpp/clang_completer.py +++ b/python/completers/cpp/clang_completer.py @@ -45,6 +45,14 @@ class ClangCompleter( Completer ): def GetUnsavedFilesVector( self ): + # CAREFUL HERE! For UnsavedFile filename and contents we are referring + # directly to Python-allocated and -managed memory since we are accepting + # pointers to data members of python objects. We need to ensure that those + # objects outlive our UnsavedFile objects. This is why we need the + # contents_holder and filename_holder lists, to make sure the string objects + # are still around when we call CandidatesForQueryAndLocationInFile. We do + # this to avoid an extra copy of the entire file contents. + files = ycm_core.UnsavedFileVec() self.contents_holder = [] self.filename_holder = [] @@ -76,14 +84,6 @@ class ClangCompleter( Completer ): # TODO: sanitize query - # CAREFUL HERE! For UnsavedFile filename and contents we are referring - # directly to Python-allocated and -managed memory since we are accepting - # pointers to data members of python objects. We need to ensure that those - # objects outlive our UnsavedFile objects. This is why we need the - # contents_holder and filename_holder lists, to make sure the string objects - # are still around when we call CandidatesForQueryAndLocationInFile. We do - # this to avoid an extra copy of the entire file contents. - files = ycm_core.UnsavedFileVec() if not query: files = self.GetUnsavedFilesVector()