}
#endif
+bool
+is_precompiled_header(string_view path)
+{
+ string_view ext = get_extension(path);
+ return ext == ".gch" || ext == ".pch" || ext == ".pth"
+ || get_extension(dir_name(path)) == ".gch";
+}
+
std::string
make_relative_path(const Context& ctx, string_view path)
{
;
}
+// Return whether `path` represents a precompiled header (see "Precompiled
+// Headers" in GCC docs).
+bool is_precompiled_header(nonstd::string_view path);
+
// Make a relative path from current working directory to `path` if `path` is
// under the base directory.
std::string make_relative_path(const Context& ctx, nonstd::string_view path);
args_info.output_is_precompiled_header =
args_info.actual_language.find("-header") != std::string::npos
- || is_precompiled_header(args_info.output_obj.c_str());
+ || Util::is_precompiled_header(args_info.output_obj);
if (args_info.output_is_precompiled_header
&& !(config.sloppiness() & SLOPPY_PCH_DEFINES)) {
// Let's hash the include file content.
Hash fhash;
- is_pch = is_precompiled_header(path.c_str());
+ is_pch = Util::is_precompiled_header(path);
if (is_pch) {
if (ctx.included_pch_file.empty()) {
cc_log("Detected use of precompiled header: %s", path.c_str());
ctx.orig_args[0] = compiler;
}
-bool
-is_precompiled_header(const char* path)
-{
- // See "Precompiled Headers" in GCC docs.
- string_view ext = Util::get_extension(path);
- return ext == ".gch" || ext == ".pch" || ext == ".pth"
- || Util::get_extension(Util::dir_name(path)) == ".gch";
-}
-
static void
create_initial_config_file(Config& config)
{
void block_signals();
void unblock_signals();
-bool is_precompiled_header(const char* path);
# include <immintrin.h>
#endif
-
// Returns one of HASH_SOURCE_CODE_FOUND_DATE, HASH_SOURCE_CODE_FOUND_TIME or
// HASH_SOURCE_CODE_FOUND_TIMESTAMP if "_DATE__", "_TIME__" or "_TIMESTAMP__"
// starts at str[pos].
static InodeCache::ContentType
get_content_type(const Config& config, const char* path)
{
- if (is_precompiled_header(path)) {
+ if (Util::is_precompiled_header(path)) {
return InodeCache::ContentType::precompiled_header;
}
if (config.sloppiness() & SLOPPY_TIME_MACROS) {
if (!ctx.config.inode_cache()) {
#endif
return hash_source_code_file_nocache(
- ctx, hash, path, size_hint, is_precompiled_header(path));
+ ctx, hash, path, size_hint, Util::is_precompiled_header(path));
#ifdef INODE_CACHE_SUPPORTED
}