This is an archive of the discontinued LLVM Phabricator instance.

[OpenCL] Support template parameters for as_type
ClosedPublic

Authored by svenvh on Mar 18 2021, 4:54 AM.

Details

Summary

Implement the TreeTransform for AsTypeExpr. Split BuildAsTypeExpr
out of ActOnAsTypeExpr, such that we can call the Build method from
the TreeTransform.

Diff Detail

Event Timeline

svenvh created this revision.Mar 18 2021, 4:54 AM
svenvh requested review of this revision.Mar 18 2021, 4:54 AM
Anastasia accepted this revision.Mar 18 2021, 8:04 AM
Anastasia added inline comments.
clang/test/SemaOpenCLCXX/template-astype.cl
6

could we also add another template with use of __builtin_astype directly?

In case we change as_type implementation one day the clang builtin will still be tested too. :)

This revision is now accepted and ready to land.Mar 18 2021, 8:04 AM
svenvh added inline comments.Mar 18 2021, 10:35 AM
clang/test/SemaOpenCLCXX/template-astype.cl
6

Sure, I can add extend this test with the following before committing, if that is okay with you?

// Test __builtin_astype.
template <typename T>
auto templated_builtin_astype(T x) {
  return __builtin_astype(x, int2);
}

auto test_builtin(char8 x) { return templated_builtin_astype(x); }
This revision was automatically updated to reflect the committed changes.