本文整理汇总了C++中CompileJob::blockRewriteIncludes方法的典型用法代码示例。如果您正苦于以下问题:C++ CompileJob::blockRewriteIncludes方法的具体用法?C++ CompileJob::blockRewriteIncludes怎么用?C++ CompileJob::blockRewriteIncludes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CompileJob
的用法示例。
在下文中一共展示了CompileJob::blockRewriteIncludes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: compiler_only_rewrite_includes
/*
Clang works suboptimally when handling an already preprocessed source file,
for example error messages quote (already preprocessed) parts of the source.
Therefore it is better to only locally merge all #include files into the source
file and do the actual preprocessing remotely together with compiling.
There exists a Clang patch to implement option -frewrite-includes that does
such #include rewritting, and it's been only recently merged upstream.
This is similar with newer gcc versions, and gcc has -fdirectives-only, which
works similarly to -frewrite-includes (although it's not exactly the same).
*/
bool compiler_only_rewrite_includes(const CompileJob &job)
{
if( job.blockRewriteIncludes()) {
return false;
}
if (const char *rewrite_includes = getenv("ICECC_REMOTE_CPP")) {
return (*rewrite_includes != '\0') && (*rewrite_includes != '0');
}
if (!compiler_is_clang(job)) {
#ifdef HAVE_GCC_FDIRECTIVES_ONLY
// gcc has had -fdirectives-only for a long time, but clang on macosx poses as gcc
// and fails when given the option. Since we right now detect whether a compiler
// is gcc merely by checking the binary name, enable usage only if the configure
// check found the option working.
return true;
#endif
}
if (compiler_is_clang(job)) {
if (const char *rewrite_includes = getenv("ICECC_CLANG_REMOTE_CPP")) {
return (*rewrite_includes != '\0') && (*rewrite_includes != '0');
}
#ifdef HAVE_CLANG_REWRITE_INCLUDES
// Assume that we use the same clang (as least as far as capabilities go)
// as was available when icecream was built. ICECC_CLANG_REMOTE_CPP above
// allows override, and the only case when this should realistically break
// is if somebody downgrades their clang.
return true;
#endif
}
return false;
}