Merge pull request #1633 from emankov/hipify-clang

[HIPIFY] Add a compatibility for CharSourceRange if LLVM < 7

[ROCm/hip commit: 89e4330890]
このコミットが含まれているのは:
Evgeny Mankov
2019-11-06 14:32:47 +03:00
committed by GitHub
コミット 9e3c107549
3個のファイルの変更11行の追加1行の削除
+1 -1
ファイルの表示
@@ -391,7 +391,7 @@ bool HipifyAction::cudaLaunchKernel(const mat::MatchFinder::MatchResult &Result)
}
OS << ")";
clang::SourceLocation launchKernelExprLocBeg = launchKernel->getExprLoc();
clang::SourceLocation launchKernelExprLocEnd = launchKernelExprLocBeg.isMacroID() ? SM->getExpansionRange(launchKernelExprLocBeg).getEnd() : llcompat::getEndLoc(launchKernel);
clang::SourceLocation launchKernelExprLocEnd = launchKernelExprLocBeg.isMacroID() ? llcompat::getEndOfExpansionRangeForLoc(*SM, launchKernelExprLocBeg) : llcompat::getEndLoc(launchKernel);
clang::SourceLocation launchKernelEnd = llcompat::getEndLoc(launchKernel);
clang::BeforeThanCompare<clang::SourceLocation> isBefore(*SM);
launchKernelExprLocEnd = isBefore(launchKernelEnd, launchKernelExprLocEnd) ? launchKernelExprLocEnd : launchKernelEnd;
+8
ファイルの表示
@@ -151,4 +151,12 @@ bool CheckCompatibility() {
return true;
}
clang::SourceLocation getEndOfExpansionRangeForLoc(const clang::SourceManager& SM, const clang::SourceLocation& loc) {
#if LLVM_VERSION_MAJOR > 6
return SM.getExpansionRange(loc).getEnd();
#else
return SM.getExpansionRange(loc).second;
#endif
}
} // namespace llcompat
+2
ファイルの表示
@@ -91,4 +91,6 @@ void RetainExcludedConditionalBlocks(clang::CompilerInstance &CI);
bool CheckCompatibility();
clang::SourceLocation getEndOfExpansionRangeForLoc(const clang::SourceManager& SM, const clang::SourceLocation& loc);
} // namespace llcompat