From: Argyrios Kyrtzidis Date: Sun, 20 Mar 2011 18:17:52 +0000 (+0000) Subject: In clang_parseTranslationUnit_Impl,p ut the source file after command_line_args otherwise X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c842955140adf7b0a7c73c61390bf580c50a182d;p=clang In clang_parseTranslationUnit_Impl,p ut the source file after command_line_args otherwise if '-x' flag is present it will be unused. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127971 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp index 502ee9958d..500b1a51af 100644 --- a/tools/libclang/CIndex.cpp +++ b/tools/libclang/CIndex.cpp @@ -2404,12 +2404,6 @@ static void clang_parseTranslationUnit_Impl(void *UserData) { } llvm::SmallVector Args; - - // 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. - if (source_filename) - Args.push_back(source_filename); // Since the Clang C library is primarily used by batch tools dealing with // (often very broken) source code, where spell-checking can have a @@ -2430,6 +2424,14 @@ static void clang_parseTranslationUnit_Impl(void *UserData) { Args.insert(Args.end(), command_line_args, command_line_args + num_command_line_args); + // 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. + // Put the source file after command_line_args otherwise if '-x' flag is + // present it will be unused. + if (source_filename) + Args.push_back(source_filename); + // Do we need the detailed preprocessing record? if (options & CXTranslationUnit_DetailedPreprocessingRecord) { Args.push_back("-Xclang");