当前位置: 首页>>代码示例>>C++>>正文


C++ CompileJob::blockRewriteIncludes方法代码示例

本文整理汇总了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;
}
开发者ID:HenryMiller1,项目名称:icecream,代码行数:44,代码来源:local.cpp


注:本文中的CompileJob::blockRewriteIncludes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。