Skip to content

Commit 4daaa11

Browse files
committed
[Index] Use native separators for output path
1 parent a5298e5 commit 4daaa11

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

clang/lib/Index/IndexUnitWriter.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,12 @@ IndexUnitWriter::IndexUnitWriter(FileManager &FileMgr,
136136
this->ProviderIdentifier = std::string(ProviderIdentifier);
137137
this->ProviderVersion = std::string(ProviderVersion);
138138
SmallString<256> AbsOutputFile(OutputFile);
139-
if (OutputFile != "-") // Can't make stdout absolute, should stay as "-".
139+
if (OutputFile != "-") {
140+
// Can't make stdout absolute, should stay as "-".
140141
FileMgr.makeAbsolutePath(AbsOutputFile);
142+
llvm::sys::path::native(AbsOutputFile);
143+
}
144+
141145
this->OutputFile = std::string(AbsOutputFile.str());
142146
this->ModuleName = std::string(ModuleName);
143147
this->MainFile = MainFile;
@@ -227,13 +231,14 @@ void IndexUnitWriter::getUnitNameForOutputFile(StringRef FilePath,
227231
SmallVectorImpl<char> &Str) {
228232
SmallString<256> AbsPath(FilePath);
229233
FileMgr.makeAbsolutePath(AbsPath);
234+
llvm::sys::path::native(AbsPath);
230235
return getUnitNameForAbsoluteOutputFile(AbsPath, Str, Remapper);
231236
}
232237

233238
void IndexUnitWriter::getUnitPathForOutputFile(StringRef FilePath,
234239
SmallVectorImpl<char> &Str) {
235240
Str.append(UnitsPath.begin(), UnitsPath.end());
236-
Str.push_back('/');
241+
Str.push_back(llvm::sys::path::get_separator().front());
237242
return getUnitNameForOutputFile(FilePath, Str);
238243
}
239244

0 commit comments

Comments
 (0)