@@ -601,13 +601,20 @@ static bool useCAS() {
601
601
}
602
602
603
603
template <typename Container>
604
- static auto toJSONStrings (llvm::json::OStream &JOS, Container &&Strings) {
605
- return [&JOS, Strings = std::forward<Container>(Strings)] {
604
+ static auto toJSONStrings (llvm::json::OStream &JOS, Container &&Strings,
605
+ bool ArePaths = false ) {
606
+ return [&JOS, Strings = std::forward<Container>(Strings), ArePaths] {
606
607
for (StringRef Str : Strings)
607
608
// Not reporting SDKSettings.json so that test checks can remain (mostly)
608
609
// platform-agnostic.
609
610
if (!Str.ends_with (" SDKSettings.json" ))
610
- JOS.value (Str);
611
+ if (ArePaths) {
612
+ llvm::SmallString<261 > Path = Str;
613
+ llvm::sys::path::make_preferred (Path);
614
+ JOS.value (Path.str ());
615
+ } else {
616
+ JOS.value (Str);
617
+ }
611
618
};
612
619
}
613
620
@@ -810,8 +817,11 @@ class FullDeps {
810
817
toJSONStrings (JOS, Cmd.Arguments ));
811
818
JOS.attribute (" executable" , StringRef (Cmd.Executable ));
812
819
JOS.attributeArray (" file-deps" ,
813
- toJSONStrings (JOS, I.FileDeps ));
814
- JOS.attribute (" input-file" , StringRef (I.FileName ));
820
+ toJSONStrings (JOS, I.FileDeps ,
821
+ /* ArePaths*/ true ));
822
+ llvm::SmallString<261 > InputFile = StringRef (I.FileName );
823
+ llvm::sys::path::make_preferred (InputFile);
824
+ JOS.attribute (" input-file" , InputFile.str ());
815
825
if (EmitVisibleModules)
816
826
JOS.attributeArray (" visible-clang-modules" ,
817
827
toJSONSorted (JOS, I.VisibleModules ));
@@ -840,8 +850,11 @@ class FullDeps {
840
850
toJSONStrings (JOS, I.DriverCommandLine ));
841
851
JOS.attribute (" executable" , " clang" );
842
852
JOS.attributeArray (" file-deps" ,
843
- toJSONStrings (JOS, I.FileDeps ));
844
- JOS.attribute (" input-file" , StringRef (I.FileName ));
853
+ toJSONStrings (JOS, I.FileDeps ,
854
+ /* ArePaths*/ true ));
855
+ llvm::SmallString<261 > InputFile = StringRef (I.FileName );
856
+ llvm::sys::path::make_preferred (InputFile);
857
+ JOS.attribute (" input-file" , InputFile.str ());
845
858
if (EmitVisibleModules)
846
859
JOS.attributeArray (" visible-clang-modules" ,
847
860
toJSONSorted (JOS, I.VisibleModules ));
0 commit comments