// The source file path, potentially rewritten into relative.
std::string input_file;
+ // Prefix to the input file when adding it to a command line.
+ std::string input_file_prefix;
+
// The source file path run through Util::normalize_concrete_absolute_path.
std::string normalized_input_file;
return Statistic::none;
}
- // MSVC /Tc and /Tp options with no space for specifying input file.
+ // MSVC /Tc and /Tp options in concatenated form for specifying input file.
if (arg.length() > 3 && util::starts_with(arg, "-T")
&& (arg[2] == 'c' || arg[2] == 'p')) {
- state.common_args.push_back(args[i]);
+ args_info.input_file_prefix = arg.substr(0, 3);
state.input_files.emplace_back(arg.substr(3));
return Statistic::none;
}
}
if (ctx.config.run_second_cpp()) {
- args.push_back(ctx.args_info.input_file);
+ args.push_back(
+ FMT("{}{}", ctx.args_info.input_file_prefix, ctx.args_info.input_file));
} else {
args.push_back(ctx.i_tmpfile);
}
args.push_back(preprocessed_path);
}
- args.push_back(ctx.args_info.input_file);
+ args.push_back(
+ FMT("{}{}", ctx.args_info.input_file_prefix, ctx.args_info.input_file));
add_prefix(args, ctx.config.prefix_command_cpp());
LOG_RAW("Running preprocessor");
hash.hash_delimiter("inputfile");
hash.hash(ctx.args_info.input_file);
+ if (!ctx.args_info.input_file_prefix.empty()) {
+ hash.hash_delimiter("inputfile prefix");
+ hash.hash(ctx.args_info.input_file_prefix);
+ }
+
hash.hash_delimiter("sourcecode hash");
Hash::Digest input_file_digest;
auto ret =
{"-MM", TOO_HARD},
{"-MQ", TAKES_ARG},
{"-MT", TAKES_ARG},
+ {"-Tc", TAKES_ARG | TAKES_PATH | TOO_HARD}, // msvc
+ {"-Tp", TAKES_ARG | TAKES_PATH | TOO_HARD}, // msvc
{"-U", AFFECTS_CPP | TAKES_ARG | TAKES_CONCAT_ARG},
{"-V", TAKES_ARG},
{"-Wa,", TAKES_CONCAT_ARG | AFFECTS_COMP},