================
@@ -409,19 +412,26 @@ bool JSONCompilationDatabase::parse(std::string
&ErrorMessage) {
ErrorMessage = "Missing key: \"directory\".";
return false;
}
+ SmallString<8> DirectoryStorage;
+ SmallString<128> DirectoryPath(Directory->getValue(DirectoryStorage));
+ if (!BaseDirectory.empty() && !DirectoryPath.empty() &&
+ !llvm::sys::path::is_absolute(DirectoryPath)) {
+ llvm::sys::path::make_absolute(BaseDirectory, DirectoryPath);
+ llvm::sys::path::remove_dots(DirectoryPath);
+ }
+ StringRef DirectoryName =
Directories.insert(DirectoryPath).first->getKey();
SmallString<8> FileStorage;
StringRef FileName = File->getValue(FileStorage);
SmallString<128> NativeFilePath;
if (llvm::sys::path::is_relative(FileName)) {
- SmallString<8> DirectoryStorage;
- SmallString<128> AbsolutePath(Directory->getValue(DirectoryStorage));
+ SmallString<128> AbsolutePath(DirectoryName);
llvm::sys::path::append(AbsolutePath, FileName);
llvm::sys::path::native(AbsolutePath, NativeFilePath);
} else {
llvm::sys::path::native(FileName, NativeFilePath);
}
llvm::sys::path::remove_dots(NativeFilePath, /*remove_dot_dot=*/true);
----------------
ArcsinX wrote:
here
https://github.com/llvm/llvm-project/pull/235400
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits