Skip generating RenderScript annotations on implicitly defined functions

Implicitly defined functions like .rs.dtor set off assertions in Slang
backend due to lack of source location information under debug builds.

However, before this change there was no good way to check if a function
was generated implicitly by slang or defined by the user.

This change makes the slang backend aware of these declarations by setting
.rs.dtor to implicit and later skip generating annotations for them.

Bug: http://b/19545955
Test: RSTest, CTS, slang test.py on aosp_angler-eng

Change-Id: Ib5e2957906c8f30cdc08fdb207bd47fc50bc44e3
diff --git a/slang_backend.cpp b/slang_backend.cpp
index b9999d5..5ff90b9 100644
--- a/slang_backend.cpp
+++ b/slang_backend.cpp
@@ -359,6 +359,7 @@
 void Backend::AnnotateFunction(clang::FunctionDecl *FD) {
   if (FD &&
       FD->hasBody() &&
+      !FD->isImplicit() &&
       !Slang::IsLocInRSHeaderFile(FD->getLocation(), mSourceMgr)) {
     mRefCount.Init();
     mRefCount.SetDeclContext(FD);
@@ -426,7 +427,7 @@
     }
 
     if (getTargetAPI() >= SLANG_FEATURE_SINGLE_SOURCE_API) {
-      if (FD && FD->hasBody() &&
+      if (FD && FD->hasBody() && !FD->isImplicit() &&
           !Slang::IsLocInRSHeaderFile(FD->getLocation(), mSourceMgr)) {
         if (FD->hasAttr<clang::RenderScriptKernelAttr>()) {
           // Log functions with attribute "kernel" by their names, and assign
diff --git a/slang_rs_object_ref_count.cpp b/slang_rs_object_ref_count.cpp
index a52db88..2688ddc 100644
--- a/slang_rs_object_ref_count.cpp
+++ b/slang_rs_object_ref_count.cpp
@@ -1642,6 +1642,8 @@
   clang::CompoundStmt *CS = BuildCompoundStmt(mCtx, StmtList, loc);
 
   FD->setBody(CS);
+  // We need some way to tell if this FD is generated by slang
+  FD->setImplicit();
 
   return FD;
 }