Revert "Generate an error for exporting rs_objects in structs/arrays."

This reverts commit f5abb503e67587ad89bcec99ed925d4a75448dcd
diff --git a/slang_rs_backend.cpp b/slang_rs_backend.cpp
index f60017a..c99b917 100644
--- a/slang_rs_backend.cpp
+++ b/slang_rs_backend.cpp
@@ -112,7 +112,7 @@
 
 namespace {
 
-static bool ValidateVarDecl(clang::VarDecl *VD, unsigned int TargetAPI) {
+static bool ValidateVarDecl(clang::VarDecl *VD) {
   if (!VD) {
     return true;
   }
@@ -123,8 +123,7 @@
 
   if (VD->getLinkage() == clang::ExternalLinkage) {
     llvm::StringRef TypeName;
-    if (!RSExportType::NormalizeType(T, TypeName, &C.getDiagnostics(), VD,
-                                     TargetAPI)) {
+    if (!RSExportType::NormalizeType(T, TypeName, &C.getDiagnostics(), VD)) {
       valid = false;
     }
   }
@@ -133,7 +132,7 @@
   return valid;
 }
 
-static bool ValidateASTContext(clang::ASTContext &C, unsigned int TargetAPI) {
+static bool ValidateASTContext(clang::ASTContext &C) {
   bool valid = true;
   clang::TranslationUnitDecl *TUDecl = C.getTranslationUnitDecl();
   for (clang::DeclContext::decl_iterator DI = TUDecl->decls_begin(),
@@ -141,7 +140,7 @@
        DI != DE;
        DI++) {
     clang::VarDecl *VD = llvm::dyn_cast<clang::VarDecl>(*DI);
-    if (VD && !ValidateVarDecl(VD, TargetAPI)) {
+    if (VD && !ValidateVarDecl(VD)) {
       valid = false;
     }
   }
@@ -154,7 +153,7 @@
 void RSBackend::HandleTranslationUnitPre(clang::ASTContext &C) {
   clang::TranslationUnitDecl *TUDecl = C.getTranslationUnitDecl();
 
-  if (!ValidateASTContext(C, getTargetAPI())) {
+  if (!ValidateASTContext(C)) {
     return;
   }
 
diff --git a/slang_rs_export_element.cpp b/slang_rs_export_element.cpp
index e0bc897..c1b9c3c 100644
--- a/slang_rs_export_element.cpp
+++ b/slang_rs_export_element.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 2010-2012, The Android Open Source Project
+ * Copyright 2010, The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -70,7 +70,7 @@
   slangAssert(EI != NULL && "Element info not found");
 
   if (!RSExportType::NormalizeType(T, TypeName, Context->getDiagnostics(),
-                                   NULL, Context->getTargetAPI()))
+                                   NULL))
     return NULL;
 
   switch (T->getTypeClass()) {
diff --git a/slang_rs_export_type.cpp b/slang_rs_export_type.cpp
index e5311b2..843ef56 100644
--- a/slang_rs_export_type.cpp
+++ b/slang_rs_export_type.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 2010-2012, The Android Open Source Project
+ * Copyright 2010, The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -33,7 +33,6 @@
 #include "slang_rs_context.h"
 #include "slang_rs_export_element.h"
 #include "slang_rs_type_spec.h"
-#include "slang_version.h"
 
 #define CHECK_PARENT_EQUALITY(ParentClass, E) \
   if (!ParentClass::equals(E))                \
@@ -85,15 +84,12 @@
     llvm::SmallPtrSet<const clang::Type*, 8>& SPS,
     clang::DiagnosticsEngine *DiagEngine,
     const clang::VarDecl *VD,
-    const clang::RecordDecl *TopLevelRecord,
-    bool InArray,
-    unsigned int TargetAPI);
+    const clang::RecordDecl *TopLevelRecord);
 
 static void ReportTypeError(clang::DiagnosticsEngine *DiagEngine,
                             const clang::VarDecl *VD,
                             const clang::RecordDecl *TopLevelRecord,
-                            const char *Message,
-                            unsigned int TargetAPI = 0) {
+                            const char *Message) {
   if (!DiagEngine) {
     return;
   }
@@ -107,12 +103,12 @@
     DiagEngine->Report(
       clang::FullSourceLoc(TopLevelRecord->getLocation(), SM),
       DiagEngine->getCustomDiagID(clang::DiagnosticsEngine::Error, Message))
-      << TopLevelRecord->getName() << TargetAPI;
+      << TopLevelRecord->getName();
   } else if (VD) {
     DiagEngine->Report(
       clang::FullSourceLoc(VD->getLocation(), SM),
       DiagEngine->getCustomDiagID(clang::DiagnosticsEngine::Error, Message))
-      << VD->getName() << TargetAPI;
+      << VD->getName();
   } else {
     slangAssert(false && "Variables should be validated before exporting");
   }
@@ -123,8 +119,7 @@
     llvm::SmallPtrSet<const clang::Type*, 8>& SPS,
     clang::DiagnosticsEngine *DiagEngine,
     const clang::VarDecl *VD,
-    const clang::RecordDecl *TopLevelRecord,
-    unsigned int TargetAPI) {
+    const clang::RecordDecl *TopLevelRecord) {
   // Check element type
   const clang::Type *ElementType = GET_CONSTANT_ARRAY_ELEMENT_TYPE(CAT);
   if (ElementType->isArrayType()) {
@@ -151,11 +146,10 @@
   }
 
   if (TypeExportableHelper(ElementType, SPS, DiagEngine, VD,
-                           TopLevelRecord, true, TargetAPI) == NULL) {
+                           TopLevelRecord) == NULL)
     return NULL;
-  } else {
+  else
     return CAT;
-  }
 }
 
 static const clang::Type *TypeExportableHelper(
@@ -163,9 +157,7 @@
     llvm::SmallPtrSet<clang::Type const *, 8> &SPS,
     clang::DiagnosticsEngine *DiagEngine,
     clang::VarDecl const *VD,
-    clang::RecordDecl const *TopLevelRecord,
-    bool InArray,
-    unsigned int TargetAPI) {
+    clang::RecordDecl const *TopLevelRecord) {
   // Normalize first
   if ((T = GET_CANONICAL_TYPE(T)) == NULL)
     return NULL;
@@ -190,30 +182,12 @@
     }
     case clang::Type::Record: {
       if (RSExportPrimitiveType::GetRSSpecificType(T) !=
-          RSExportPrimitiveType::DataTypeUnknown) {
-        if (TargetAPI < SLANG_JB_TARGET_API) {
-          // TopLevelRecord denotes an outer struct around the RS type.
-          if (TopLevelRecord) {
-            ReportTypeError(DiagEngine, VD, TopLevelRecord,
-                            "structures containing RS object types cannot "
-                            "be exported in target API < %1: '%0'",
-                            SLANG_JB_TARGET_API);
-            return NULL;
-          } else if (InArray) {
-            ReportTypeError(DiagEngine, VD, TopLevelRecord,
-                            "arrays containing RS object types cannot "
-                            "be exported in target API < %1: '%0'",
-                            SLANG_JB_TARGET_API);
-            return NULL;
-          }
-        }
-
+          RSExportPrimitiveType::DataTypeUnknown)
         return T;  // RS object type, no further checks are needed
-      }
 
       // Check internal struct
       if (T->isUnionType()) {
-        ReportTypeError(DiagEngine, VD, T->getAsUnionType()->getDecl(),
+        ReportTypeError(DiagEngine, NULL, T->getAsUnionType()->getDecl(),
                         "unions cannot be exported: '%0'");
         return NULL;
       } else if (!T->isStructureType()) {
@@ -256,8 +230,7 @@
         const clang::Type *FT = RSExportType::GetTypeOfDecl(FD);
         FT = GET_CANONICAL_TYPE(FT);
 
-        if (!TypeExportableHelper(FT, SPS, DiagEngine, VD, TopLevelRecord,
-                                  InArray, TargetAPI)) {
+        if (!TypeExportableHelper(FT, SPS, DiagEngine, VD, TopLevelRecord)) {
           return NULL;
         }
 
@@ -298,7 +271,7 @@
       // type
       if (PointeeType->isArrayType() ||
           (TypeExportableHelper(PointeeType, SPS, DiagEngine, VD,
-                                TopLevelRecord, InArray, TargetAPI) == NULL))
+                                TopLevelRecord) == NULL))
         return NULL;
       else
         return T;
@@ -315,7 +288,7 @@
 
       if ((ElementType->getTypeClass() != clang::Type::Builtin) ||
           (TypeExportableHelper(ElementType, SPS, DiagEngine, VD,
-                                TopLevelRecord, InArray, TargetAPI) == NULL))
+                                TopLevelRecord) == NULL))
         return NULL;
       else
         return T;
@@ -325,7 +298,7 @@
           UNSAFE_CAST_TYPE(const clang::ConstantArrayType, T);
 
       return ConstantArrayTypeExportableHelper(CAT, SPS, DiagEngine, VD,
-                                               TopLevelRecord, TargetAPI);
+                                               TopLevelRecord);
     }
     default: {
       return NULL;
@@ -342,12 +315,11 @@
 // types that cannot be exported (mostly pointers within a struct).
 static const clang::Type *TypeExportable(const clang::Type *T,
                                          clang::DiagnosticsEngine *DiagEngine,
-                                         const clang::VarDecl *VD,
-                                         unsigned int TargetAPI) {
+                                         const clang::VarDecl *VD) {
   llvm::SmallPtrSet<const clang::Type*, 8> SPS =
       llvm::SmallPtrSet<const clang::Type*, 8>();
 
-  return TypeExportableHelper(T, SPS, DiagEngine, VD, NULL, false, TargetAPI);
+  return TypeExportableHelper(T, SPS, DiagEngine, VD, NULL);
 }
 
 static bool ValidateVarDeclHelper(
@@ -460,9 +432,8 @@
 bool RSExportType::NormalizeType(const clang::Type *&T,
                                  llvm::StringRef &TypeName,
                                  clang::DiagnosticsEngine *DiagEngine,
-                                 const clang::VarDecl *VD,
-                                 unsigned int TargetAPI) {
-  if ((T = TypeExportable(T, DiagEngine, VD, TargetAPI)) == NULL) {
+                                 const clang::VarDecl *VD) {
+  if ((T = TypeExportable(T, DiagEngine, VD)) == NULL) {
     return false;
   }
   // Get type name
@@ -569,8 +540,7 @@
       // "*" plus pointee name
       const clang::Type *PT = GET_POINTEE_TYPE(T);
       llvm::StringRef PointeeName;
-      if (NormalizeType(PT, PointeeName, NULL, NULL,
-                        SLANG_MAXIMUM_TARGET_API)) {
+      if (NormalizeType(PT, PointeeName, NULL, NULL)) {
         char *Name = new char[ 1 /* * */ + PointeeName.size() + 1 ];
         Name[0] = '*';
         memcpy(Name + 1, PointeeName.data(), PointeeName.size());
@@ -691,12 +661,10 @@
 
 RSExportType *RSExportType::Create(RSContext *Context, const clang::Type *T) {
   llvm::StringRef TypeName;
-  if (NormalizeType(T, TypeName, Context->getDiagnostics(), NULL,
-                    Context->getTargetAPI())) {
+  if (NormalizeType(T, TypeName, Context->getDiagnostics(), NULL))
     return Create(Context, T, TypeName);
-  } else {
+  else
     return NULL;
-  }
 }
 
 RSExportType *RSExportType::CreateFromDecl(RSContext *Context,
@@ -935,8 +903,7 @@
 RSExportPrimitiveType *RSExportPrimitiveType::Create(RSContext *Context,
                                                      const clang::Type *T) {
   llvm::StringRef TypeName;
-  if (RSExportType::NormalizeType(T, TypeName, Context->getDiagnostics(), NULL,
-                                  Context->getTargetAPI())
+  if (RSExportType::NormalizeType(T, TypeName, Context->getDiagnostics(), NULL)
       && IsPrimitiveType(T)) {
     return Create(Context, T, TypeName);
   } else {
diff --git a/slang_rs_export_type.h b/slang_rs_export_type.h
index a525ff4..e3d8f78 100644
--- a/slang_rs_export_type.h
+++ b/slang_rs_export_type.h
@@ -1,5 +1,5 @@
 /*
- * Copyright 2010-2012, The Android Open Source Project
+ * Copyright 2010, The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -154,8 +154,7 @@
   static bool NormalizeType(const clang::Type *&T,
                             llvm::StringRef &TypeName,
                             clang::DiagnosticsEngine *Diags,
-                            const clang::VarDecl *VD,
-                            unsigned int TargetAPI);
+                            const clang::VarDecl *VD);
 
   // This function ensures that the VarDecl can be properly handled by RS.
   // If it cannot, this function returns false. Otherwise it returns true.
diff --git a/tests/F_refcount_15/refcount_15.rs b/tests/F_refcount_15/refcount_15.rs
deleted file mode 100644
index a1b2042..0000000
--- a/tests/F_refcount_15/refcount_15.rs
+++ /dev/null
@@ -1,16 +0,0 @@
-// -target-api 15
-#pragma version(1)
-#pragma rs java_package_name(foo)
-
-rs_allocation a[2];
-
-struct rsStruct {
-    rs_allocation a;
-} s;
-
-static rs_allocation aOk[2];
-
-static struct noExport {
-    rs_allocation a;
-} sOk;
-
diff --git a/tests/F_refcount_15/stderr.txt.expect b/tests/F_refcount_15/stderr.txt.expect
deleted file mode 100644
index ea4bf12..0000000
--- a/tests/F_refcount_15/stderr.txt.expect
+++ /dev/null
@@ -1,2 +0,0 @@
-refcount_15.rs:5:15: error: arrays containing RS object types cannot be exported in target API < 16: 'a'
-refcount_15.rs:7:8: error: structures containing RS object types cannot be exported in target API < 16: 'rsStruct'
diff --git a/tests/F_refcount_15/stdout.txt.expect b/tests/F_refcount_15/stdout.txt.expect
deleted file mode 100644
index e69de29..0000000
--- a/tests/F_refcount_15/stdout.txt.expect
+++ /dev/null