Support dummy root() and re-ordering in presence of non-root kernels.

BUG=6000538

Change-Id: Ib3ed249916d36acf68ab32e9216804ae1da5e991
diff --git a/slang_rs_reflection.cpp b/slang_rs_reflection.cpp
index 4b2a04c..259931b 100644
--- a/slang_rs_reflection.cpp
+++ b/slang_rs_reflection.cpp
@@ -977,6 +977,15 @@
 }
 
 void RSReflection::genExportForEach(Context &C, const RSExportForEach *EF) {
+  if (EF->isDummyRoot()) {
+    // Skip reflection for dummy root() kernels. Note that we have to
+    // advance the next slot number for ForEach, however.
+    C.indent() << "//private final static int "RS_EXPORT_FOREACH_INDEX_PREFIX
+               << EF->getName() << " = " << C.getNextExportForEachSlot() << ";"
+               << std::endl;
+    return;
+  }
+
   C.indent() << "private final static int "RS_EXPORT_FOREACH_INDEX_PREFIX
              << EF->getName() << " = " << C.getNextExportForEachSlot() << ";"
              << std::endl;