Represent Clang macro definitions from -Xcc options in the debug info.

Currently -Xcc options are serialized in Swift modules, but they are
not saved as attributes to the DW_TAG_module representing the imported
clang module. This patch saves all *user-specified* -D macros there,
but it does not save any macros that are added by the ClangImporter
itself.

<rdar://problem/31990102>
This commit is contained in:
Adrian Prantl
2017-05-09 16:41:56 -07:00
parent 62e80281f2
commit e2784cbb87
4 changed files with 40 additions and 5 deletions

View File

@@ -1470,6 +1470,14 @@ static bool ParseIRGenArgs(IRGenOptions &Opts, ArgList &Args,
}
}
for (const Arg *A : make_range(Args.filtered_begin(OPT_Xcc),
Args.filtered_end())) {
StringRef Opt = A->getValue();
if (Opt.startswith("-D") || Opt.startswith("-U"))
Opts.ClangDefines.push_back(Opt);
}
for (const Arg *A : make_range(Args.filtered_begin(OPT_l, OPT_framework),
Args.filtered_end())) {
LibraryKind Kind;