Skip to content

Commit

Permalink
[OpenCL] Fix version reporting of C++ for OpenCL 2021
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Topotuna committed Aug 20, 2021
1 parent 25c8ffa commit 9ae9262
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions clang/lib/Basic/LangOptions.cpp
Expand Up @@ -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);
}

Expand Down

0 comments on commit 9ae9262

Please sign in to comment.