am 4e554b76: am e830bf41: Merge "When validating reduce kernels, ignore CV qualification differences between the return type and a parameter type."

* commit '4e554b769e7f9169531876dd61254390c2fe4a91':
  When validating reduce kernels, ignore CV qualification differences between the return type and a parameter type.
diff --git a/slang_rs_export_reduce.cpp b/slang_rs_export_reduce.cpp
index 778be31..eae72ad 100644
--- a/slang_rs_export_reduce.cpp
+++ b/slang_rs_export_reduce.cpp
@@ -20,6 +20,7 @@
 #include <string>
 
 #include "clang/AST/Attr.h"
+#include "clang/AST/ASTContext.h"
 
 #include "slang_assert.h"
 #include "slang_rs_context.h"
@@ -61,6 +62,8 @@
   slangAssert(Context && FD);
   bool Valid = true;
 
+  clang::ASTContext &ASTCtx = FD->getASTContext();
+
   // Validate API version.
   if (!haveReduceInTargetAPI(Context->getTargetAPI())) {
     Context->ReportError(FD->getLocation(),
@@ -116,7 +119,7 @@
     }
 
     // Check for type mismatch between this parameter and the return type.
-    if (ParamTy != ReturnTy) {
+    if (!ASTCtx.hasSameUnqualifiedType(ReturnTy, ParamTy)) {
       Context->ReportError(FD->getLocation(),
                            "Reduce-style kernel %0() return type '%1' is not "
                            "the same type as parameter '%2' (type '%3')")
diff --git a/tests/P_reduce_ignore_cv/reduce_ignore_cv.rs b/tests/P_reduce_ignore_cv/reduce_ignore_cv.rs
new file mode 100644
index 0000000..0a055ca
--- /dev/null
+++ b/tests/P_reduce_ignore_cv/reduce_ignore_cv.rs
@@ -0,0 +1,15 @@
+// -target-api 0
+#pragma version(1)
+#pragma rs java_package_name(foo)
+
+typedef struct foo {
+  int x[10];
+} foo;
+
+foo __attribute__((kernel("reduce"))) add_foo_a(const foo a, const foo b) {
+  foo tmp = a;
+  for (int i = 0; i < 10; ++i)
+    tmp.x[i] += b.x[i];
+  return tmp;
+}
+
diff --git a/tests/P_reduce_ignore_cv/stderr.txt.expect b/tests/P_reduce_ignore_cv/stderr.txt.expect
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/P_reduce_ignore_cv/stderr.txt.expect
diff --git a/tests/P_reduce_ignore_cv/stdout.txt.expect b/tests/P_reduce_ignore_cv/stdout.txt.expect
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/P_reduce_ignore_cv/stdout.txt.expect