mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Apply review feedback.
This commit is contained in:
@@ -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) +
|
||||
|
||||
@@ -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]>,
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user