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