Apply review feedback.

This commit is contained in:
Tony Allevato
2018-07-06 21:00:06 -07:00
parent 5e79910d39
commit 346e1c3317
3 changed files with 9 additions and 1 deletions

View File

@@ -46,6 +46,11 @@ public:
/// Returns a remapped `Path` if it starts with a prefix in the map; otherwise
/// the original path is returned.
std::string remapPath(StringRef Path) const {
// Clang's implementation of this feature also compares the path string
// directly instead of treating path segments as indivisible units. The
// latter would arguably be more accurate, but we choose to preserve
// compatibility with Clang (especially because we propagate the flag to
// ClangImporter as well).
for (const auto &Mapping : PathMappings)
if (Path.startswith(Mapping.first))
return (Twine(Mapping.second) +

View File

@@ -472,7 +472,7 @@ def gdwarf_types : Flag<["-"], "gdwarf-types">,
HelpText<"Emit full DWARF type info.">;
def debug_prefix_map : Separate<["-"], "debug-prefix-map">,
Flags<[FrontendOption]>,
HelpText<"remap source paths and search paths in debug info">;
HelpText<"Remap source paths and search paths in debug info">;
def debug_info_format : Joined<["-"], "debug-info-format=">,
Flags<[FrontendOption]>,

View File

@@ -397,6 +397,9 @@ static bool ParseClangImporterArgs(ClangImporterOptions &Opts,
// Forward -debug-prefix-map arguments from Swift to Clang as
// -fdebug-prefix-map. This is required to ensure DIFiles created there,
// like "<swift-imported-modules>", have their paths remapped properly.
// (Note, however, that Clang's usage of std::map means that the remapping
// may not be applied in the same order, which can matter if one mapping is
// a prefix of another.)
Opts.ExtraArgs.push_back("-fdebug-prefix-map=" + A);
}