Skip to content

Commit 94b7268

Browse files
committed
Fix path
Signed-off-by: Jiang, Zhiwei <zhiwei.jiang@intel.com>
1 parent b4dc41d commit 94b7268

3 files changed

Lines changed: 35 additions & 4 deletions

File tree

clang/include/clang/Tooling/Core/Replacement.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -478,8 +478,7 @@ class AddFileHunk : public Hunk {
478478

479479
public:
480480
AddFileHunk() : Hunk(AddFile) {}
481-
AddFileHunk(std::string NewFilePath)
482-
: Hunk(AddFile), NewFilePath(std::move(NewFilePath)) {}
481+
AddFileHunk(std::string NewFilePath);
483482
const std::string &getNewFilePath() const { return NewFilePath; }
484483
};
485484

@@ -488,8 +487,7 @@ class DeleteFileHunk : public Hunk {
488487

489488
public:
490489
DeleteFileHunk() : Hunk(DeleteFile) {}
491-
DeleteFileHunk(std::string OldFilePath)
492-
: Hunk(DeleteFile), OldFilePath(std::move(OldFilePath)) {}
490+
DeleteFileHunk(std::string OldFilePath);
493491
const std::string &getOldFilePath() const { return OldFilePath; }
494492
};
495493

clang/lib/DPCT/IncMigration/ReMigration.cpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,33 @@
1111

1212
namespace clang::dpct {
1313

14+
static void dumpGitDiffChanges(const clang::tooling::GitDiffChanges& GHC) {
15+
llvm::errs() << "GitDiffChanges:\n";
16+
llvm::errs() << " ModifyFileHunks:\n";
17+
for (const auto &Hunk : GHC.ModifyFileHunks) {
18+
llvm::errs() << " - FilePath: " << Hunk.getFilePath() << "\n";
19+
llvm::errs() << " Offset: " << Hunk.getOffset() << "\n";
20+
llvm::errs() << " Length: " << Hunk.getLength() << "\n";
21+
llvm::errs() << " ReplacementText: " << Hunk.getReplacementText() << "\n";
22+
}
23+
llvm::errs() << " AddFileHunks:\n";
24+
for (const auto &Hunk : GHC.AddFileHunks) {
25+
llvm::errs() << " - NewFilePath: " << Hunk.getNewFilePath() << "\n";
26+
}
27+
llvm::errs() << " DeleteFileHunks:\n";
28+
for (const auto &Hunk : GHC.DeleteFileHunks) {
29+
llvm::errs() << " - OldFilePath: " << Hunk.getOldFilePath() << "\n";
30+
}
31+
llvm::errs() << " MoveFileHunks:\n";
32+
for (const auto &Hunk : GHC.MoveFileHunks) {
33+
llvm::errs() << " - FilePath: " << Hunk.getFilePath() << "\n";
34+
llvm::errs() << " Offset: " << Hunk.getOffset() << "\n";
35+
llvm::errs() << " Length: " << Hunk.getLength() << "\n";
36+
llvm::errs() << " ReplacementText: " << Hunk.getReplacementText() << "\n";
37+
llvm::errs() << " NewFilePath: " << Hunk.getNewFilePath() << "\n";
38+
}
39+
}
40+
1441
void tryLoadingUpstreamChangesAndUserChanges() {
1542
llvm::SmallString<128> UpstreamChangesFilePath(
1643
DpctGlobalInfo::getInRoot().getCanonicalPath());

clang/lib/Tooling/Core/Replacement.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -727,6 +727,12 @@ std::map<std::string, Replacements> groupReplacementsByFile(
727727
return Result;
728728
}
729729
#ifdef SYCLomatic_CUSTOMIZATION
730+
AddFileHunk::AddFileHunk(std::string NewFilePath)
731+
: Hunk(AddFile), NewFilePath(UnifiedPath(NewFilePath).getCanonicalPath()) {}
732+
DeleteFileHunk::DeleteFileHunk(std::string OldFilePath)
733+
: Hunk(DeleteFile),
734+
OldFilePath(UnifiedPath(OldFilePath).getCanonicalPath()) {}
735+
730736
#undef Replacement
731737
#endif // SYCLomatic_CUSTOMIZATION
732738

0 commit comments

Comments
 (0)