Skip to content

Commit 346e1c3

Browse files
committed
Apply review feedback.
1 parent 5e79910 commit 346e1c3

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

include/swift/Basic/PathRemapper.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ class PathRemapper {
4646
/// Returns a remapped `Path` if it starts with a prefix in the map; otherwise
4747
/// the original path is returned.
4848
std::string remapPath(StringRef Path) const {
49+
// Clang's implementation of this feature also compares the path string
50+
// directly instead of treating path segments as indivisible units. The
51+
// latter would arguably be more accurate, but we choose to preserve
52+
// compatibility with Clang (especially because we propagate the flag to
53+
// ClangImporter as well).
4954
for (const auto &Mapping : PathMappings)
5055
if (Path.startswith(Mapping.first))
5156
return (Twine(Mapping.second) +

include/swift/Option/Options.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ def gdwarf_types : Flag<["-"], "gdwarf-types">,
472472
HelpText<"Emit full DWARF type info.">;
473473
def debug_prefix_map : Separate<["-"], "debug-prefix-map">,
474474
Flags<[FrontendOption]>,
475-
HelpText<"remap source paths and search paths in debug info">;
475+
HelpText<"Remap source paths and search paths in debug info">;
476476

477477
def debug_info_format : Joined<["-"], "debug-info-format=">,
478478
Flags<[FrontendOption]>,

lib/Frontend/CompilerInvocation.cpp

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

0 commit comments

Comments
 (0)