Fix 'vector subscription out of range' MSVC assertions
This commit is contained in:
parent
df0be9fb2c
commit
79b3e97abe
@ -56,13 +56,14 @@ TranslationUnit::TranslationUnit(
|
||||
|
||||
std::vector< CXUnsavedFile > cxunsaved_files =
|
||||
ToCXUnsavedFiles( unsaved_files );
|
||||
const UnsavedFile *unsaved = cxunsaved_files.size() > 0 ? &unsaved_files [0] : NULL;
|
||||
|
||||
clang_translation_unit_ = clang_parseTranslationUnit(
|
||||
clang_index,
|
||||
filename.c_str(),
|
||||
&pointer_flags[ 0 ],
|
||||
pointer_flags.size(),
|
||||
&cxunsaved_files[ 0 ],
|
||||
(CXUnsavedFile *)unsaved,
|
||||
cxunsaved_files.size(),
|
||||
clang_defaultEditingTranslationUnitOptions() );
|
||||
|
||||
@ -154,7 +155,7 @@ std::vector< CompletionData > TranslationUnit::CandidatesForLocation(
|
||||
|
||||
std::vector< CXUnsavedFile > cxunsaved_files =
|
||||
ToCXUnsavedFiles( unsaved_files );
|
||||
|
||||
const UnsavedFile *unsaved = cxunsaved_files.size() > 0 ? &unsaved_files [0] : NULL;
|
||||
// codeCompleteAt reparses the TU if the underlying source file has changed on
|
||||
// disk since the last time the TU was updated and there are no unsaved files.
|
||||
// If there are unsaved files, then codeCompleteAt will parse the in-memory
|
||||
@ -170,7 +171,7 @@ std::vector< CompletionData > TranslationUnit::CandidatesForLocation(
|
||||
filename_.c_str(),
|
||||
line,
|
||||
column,
|
||||
&cxunsaved_files[ 0 ],
|
||||
(CXUnsavedFile *)unsaved,
|
||||
cxunsaved_files.size(),
|
||||
clang_defaultCodeCompleteOptions() ),
|
||||
clang_disposeCodeCompleteResults );
|
||||
@ -249,10 +250,10 @@ void TranslationUnit::Reparse( std::vector< CXUnsavedFile > &unsaved_files,
|
||||
|
||||
if ( !clang_translation_unit_ )
|
||||
return;
|
||||
|
||||
CXUnsavedFile *unsaved = unsaved_files.size() > 0 ? &unsaved_files [0] : NULL;
|
||||
failure = clang_reparseTranslationUnit( clang_translation_unit_,
|
||||
unsaved_files.size(),
|
||||
&unsaved_files[ 0 ],
|
||||
unsaved,
|
||||
parse_options );
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user