本文整理汇总了C++中CompileJob::setLanguage方法的典型用法代码示例。如果您正苦于以下问题:C++ CompileJob::setLanguage方法的具体用法?C++ CompileJob::setLanguage怎么用?C++ CompileJob::setLanguage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CompileJob
的用法示例。
在下文中一共展示了CompileJob::setLanguage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: analyze_program
static bool analyze_program(const char* name, CompileJob& job)
{
string compiler_name = find_basename( name );
string::size_type pos = compiler_name.rfind('/');
if (pos != string::npos)
compiler_name = compiler_name.substr(pos);
job.setCompilerName( compiler_name );
string suffix = compiler_name;
if ( compiler_name.size() > 2)
suffix = compiler_name.substr(compiler_name.size()-2);
if (suffix == "++" || suffix == "CC")
job.setLanguage (CompileJob::Lang_CXX);
else if (suffix == "cc")
job.setLanguage (CompileJob::Lang_C);
else if (compiler_name == "clang")
job.setLanguage (CompileJob::Lang_C);
else {
job.setLanguage( CompileJob::Lang_Custom );
job.setCompilerName( name ); // keep path
return true;
}
return false;
}
示例2: analyse_argv
bool analyse_argv( const char * const *argv,
CompileJob &job, bool icerun, list<string> *extrafiles )
{
ArgumentsList args;
string ofile;
#if CLIENT_DEBUG > 1
trace() << "scanning arguments ";
for ( int index = 0; argv[index]; index++ )
trace() << argv[index] << " ";
trace() << endl;
#endif
bool had_cc = (job.compilerName().size() > 0);
bool always_local = analyze_program(had_cc ? job.compilerName().c_str() : argv[0], job);
bool seen_c = false;
bool seen_s = false;
bool seen_mf = false;
bool seen_md = false;
bool fno_color_diagnostics = false;
// if rewriting includes and precompiling on remote machine, then cpp args are not local
Argument_Type Arg_Cpp = compiler_only_rewrite_includes( job ) ? Arg_Rest : Arg_Local;
if( icerun ) {
always_local = true;
job.setLanguage( CompileJob::Lang_Custom );
}
for (int i = had_cc ? 2 : 1; argv[i]; i++) {
const char *a = argv[i];
if (icerun) {
args.append(a, Arg_Local);
} else if (a[0] == '-') {
if (!strcmp(a, "-E") || !strncmp(a, "-fdump", 6) || !strcmp(a, "-combine")) {
always_local = true;
args.append(a, Arg_Local);
} else if (!strcmp(a, "-MD") || !strcmp(a, "-MMD")) {
seen_md = true;
args.append(a, Arg_Local);
/* These two generate dependencies as a side effect. They
* should work with the way we call cpp. */
} else if (!strcmp(a, "-MG") || !strcmp(a, "-MP")) {
args.append(a, Arg_Local);
/* These just modify the behaviour of other -M* options and do
* nothing by themselves. */
} else if (!strcmp(a, "-MF")) {
seen_mf = true;
args.append(a, Arg_Local);
args.append( argv[++i], Arg_Local );
/* as above but with extra argument */
} else if (!strcmp(a, "-MT") || !strcmp(a, "-MQ")) {
args.append(a, Arg_Local);
args.append( argv[++i], Arg_Local );
/* as above but with extra argument */
} else if (a[1] == 'M') {
/* -M(anything else) causes the preprocessor to
produce a list of make-style dependencies on
header files, either to stdout or to a local file.
It implies -E, so only the preprocessor is run,
not the compiler. There would be no point trying
to distribute it even if we could. */
always_local = true;
args.append(a, Arg_Local);
} else if ( str_equal( "--param", a ) ) {
args.append( a, Arg_Remote );
/* skip next word, being option argument */
if (argv[i+1])
args.append( argv[++i], Arg_Remote );
} else if ( a[1] == 'B' ) {
/* -B overwrites the path where the compiler finds the assembler.
As we don't use that, better force local job.
*/
always_local = true;
args.append( a, Arg_Local );
if ( str_equal( a, "-B" ) ) {
/* skip next word, being option argument */
if (argv[i+1])
args.append( argv[++i], Arg_Local );
}
} else if (str_startswith("-Wa,", a)) {
/* Options passed through to the assembler. The only one we
* need to handle so far is -al=output, which directs the
* listing to the named file and cannot be remote. There are
* some other options which also refer to local files,
* but most of them make no sense when called via the compiler,
* hence we only look for -a[a-z]*= and localize the job if we
* find it. */
const char *pos = a;
bool local = false;
while ((pos = strstr(pos+1, "-a"))) {
pos += 2;
while (*pos >= 'a' && *pos <= 'z')
pos++;
if (*pos == '=') {
local = true;
break;
}
if (!*pos)
break;
}
//.........这里部分代码省略.........