#include "diagnostic-core.h"
#include "mapper-client.h"
#include "intl.h"
+#include "mkdeps.h"
#include "../../c++tools/resolver.h"
module_client *
module_client::open_module_client (location_t loc, const char *o,
+ class mkdeps *deps,
void (*set_repo) (const char *),
char const *full_program_name)
{
errmsg = "opening";
else
{
+ /* Add the mapper file to the dependency tracking. */
+ if (deps)
+ deps_add_dep (deps, name.c_str ());
if (int l = r->read_tuple_file (fd, ident, false))
{
if (l > 0)
/* Our module mapper (created lazily). */
module_client *mapper;
-static module_client *make_mapper (location_t loc);
-inline module_client *get_mapper (location_t loc)
+static module_client *make_mapper (location_t loc, class mkdeps *deps);
+inline module_client *get_mapper (location_t loc, class mkdeps *deps)
{
auto *res = mapper;
if (!res)
- res = make_mapper (loc);
+ res = make_mapper (loc, deps);
return res;
}
/* Create a new mapper connecting to OPTION. */
module_client *
-make_mapper (location_t loc)
+make_mapper (location_t loc, class mkdeps *deps)
{
timevar_start (TV_MODULE_MAPPER);
const char *option = module_mapper_name;
option = getenv ("CXX_MODULE_MAPPER");
mapper = module_client::open_module_client
- (loc, option, &set_cmi_repo,
+ (loc, option, deps, &set_cmi_repo,
(save_decoded_options[0].opt_index == OPT_SPECIAL_program_name)
&& save_decoded_options[0].arg != progname
? save_decoded_options[0].arg : nullptr);
dump.push (NULL);
dump () && dump ("Checking include translation '%s'", path);
- auto *mapper = get_mapper (cpp_main_loc (reader));
+ auto *mapper = get_mapper (cpp_main_loc (reader), cpp_get_deps (reader));
size_t len = strlen (path);
path = canonicalize_header_name (NULL, loc, true, path, len);
static void
name_pending_imports (cpp_reader *reader)
{
- auto *mapper = get_mapper (cpp_main_loc (reader));
+ auto *mapper = get_mapper (cpp_main_loc (reader), cpp_get_deps (reader));
if (!vec_safe_length (pending_imports))
/* Not doing anything. */
if (!flag_module_lazy)
/* Get the mapper now, if we're not being lazy. */
- get_mapper (cpp_main_loc (reader));
+ get_mapper (cpp_main_loc (reader), cpp_get_deps (reader));
if (!flag_preprocess_only)
{
if (!errorcount)
{
- auto *mapper = get_mapper (cpp_main_loc (reader));
+ auto *mapper = get_mapper (cpp_main_loc (reader), cpp_get_deps (reader));
mapper->ModuleCompiled (state->get_flatname ());
}
else if (cookie->cmi_name)
self.path = path
+class OrderInput(Token):
+ def __init__(self, path):
+ self.path = path
+
+
class Colon(Token):
pass
if word.endswith(':'):
tokenized.append(word[:-1])
word = word[-1]
+ # Detect `:` at the end of a word.
+ if word.endswith(':|'):
+ tokenized.append(word[:-2])
+ word = word[-2]
# Add word to the tokenized set.
tokenized.append(word)
kind = 'dependency'
elif token == '+=':
kind = 'append'
+ elif token == ':|':
+ kind = 'order-only'
if line == ['']:
kind = 'empty'
line_parse.append(Input(token))
else:
line_parse.append(Output(token))
+ elif kind == 'order-only':
+ after_op = False
+ for token in line:
+ if token == ':|':
+ after_op = True
+ elif after_op:
+ line_parse.append(OrderInput(token))
+ else:
+ line_parse.append(Output(token))
elif kind == 'append':
after_op = False
for token in line: