diff options
Diffstat (limited to 'clang/tools/libclang/CIndex.cpp')
-rw-r--r-- | clang/tools/libclang/CIndex.cpp | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp index 2361b009537..c50b41408a7 100644 --- a/clang/tools/libclang/CIndex.cpp +++ b/clang/tools/libclang/CIndex.cpp @@ -3089,12 +3089,12 @@ clang_parseTranslationUnit_Impl(CXIndex CIdx, const char *source_filename, break; } } - if (!FoundSpellCheckingArgument) - Args->push_back("-fno-spell-checking"); - Args->insert(Args->end(), command_line_args, command_line_args + num_command_line_args); + if (!FoundSpellCheckingArgument) + Args->insert(Args->begin() + 1, "-fno-spell-checking"); + // The 'source_filename' argument is optional. If the caller does not // specify it then it is assumed that the source file is specified // in the actual argument list. @@ -3157,14 +3157,23 @@ clang_parseTranslationUnit(CXIndex CIdx, } enum CXErrorCode clang_parseTranslationUnit2( - CXIndex CIdx, - const char *source_filename, - const char *const *command_line_args, - int num_command_line_args, - struct CXUnsavedFile *unsaved_files, - unsigned num_unsaved_files, - unsigned options, - CXTranslationUnit *out_TU) { + CXIndex CIdx, const char *source_filename, + const char *const *command_line_args, int num_command_line_args, + struct CXUnsavedFile *unsaved_files, unsigned num_unsaved_files, + unsigned options, CXTranslationUnit *out_TU) { + SmallVector<const char *, 4> Args; + Args.push_back("clang"); + Args.append(command_line_args, command_line_args + num_command_line_args); + return clang_parseTranslationUnit2FullArgv( + CIdx, source_filename, Args.data(), Args.size(), unsaved_files, + num_unsaved_files, options, out_TU); +} + +enum CXErrorCode clang_parseTranslationUnit2FullArgv( + CXIndex CIdx, const char *source_filename, + const char *const *command_line_args, int num_command_line_args, + struct CXUnsavedFile *unsaved_files, unsigned num_unsaved_files, + unsigned options, CXTranslationUnit *out_TU) { LOG_FUNC_SECTION { *Log << source_filename << ": "; for (int i = 0; i != num_command_line_args; ++i) |