[OpenCL] Fix version reporting of C++ for OpenCL 2021

C++ for OpenCL version 2021 and later are expected to consist of a
major version number only. Therefore, a different constructor for
`VersionTuple` needs to be called when reporting language version.

Differential Revision: https://reviews.llvm.org/D108379
This commit is contained in:
Justas Janickas 2021-08-19 15:43:32 +01:00
parent 25c8ffa223
commit 9ae9262857
1 changed files with 2 additions and 0 deletions

View File

@ -47,6 +47,8 @@ bool LangOptions::isNoBuiltinFunc(StringRef FuncName) const {
VersionTuple LangOptions::getOpenCLVersionTuple() const {
const int Ver = OpenCLCPlusPlus ? OpenCLCPlusPlusVersion : OpenCLVersion;
if (OpenCLCPlusPlus && Ver != 100)
return VersionTuple(Ver / 100);
return VersionTuple(Ver / 100, (Ver % 100) / 10);
}