Generate the white list used to validate unresolved externals.
Generate the file used in libbcc to verify that all the unresolved
references found in a loaded script correspond to RenderScript
APIs. We do this to prevent script from accessing functions they
should not use, e.g. malloc().
We also generate slang test files for each API level. These tests
can be used to cross-validate the generator to make sure that all
APIs can be called. These files can also be used to manually check
the white list by looking at the unresolved external references
when these files are compiled.
Change-Id: Idd4bd48e61e81a71d61445e60950bc79de88daf2
diff --git a/api/Specification.h b/api/Specification.h
index 1ec6973..df3c55c 100644
--- a/api/Specification.h
+++ b/api/Specification.h
@@ -135,6 +135,11 @@
* minVersion is greater than the maxApiLevel.
*/
bool scan(Scanner* scanner, int maxApiLevel);
+ /* Return true if the target can be found whitin the range. */
+ bool includesVersion(int target) const {
+ return (minVersion == 0 || target >= minVersion) &&
+ (maxVersion == 0 || target <= maxVersion);
+ }
};
// We have three type of definitions
@@ -398,6 +403,16 @@
// Return true if we need to generate tests for this function.
bool hasTests(int versionOfTestFiles) const;
+ bool hasInline() const { return mInline.size() > 0; }
+
+ /* Return true if this function can be overloaded. This is added by default to all
+ * specifications, so except for the very few exceptions that start the attributes
+ * with an '=' to avoid this, we'll return true.
+ */
+ bool isOverloadable() const {
+ return mAttribute.empty() || mAttribute[0] != '=';
+ }
+
// Parse a function specification and add it to specFile.
static void scanFunctionSpecification(Scanner* scanner, SpecFile* specFile, int maxApiLevel);
};
@@ -557,6 +572,9 @@
// Returns "<a href='...'> for the named specification, or empty if not found.
std::string getHtmlAnchor(const std::string& name) const;
+
+ // Returns the maximum API level specified in any spec file.
+ int getMaximumApiLevel();
};
// Singleton that represents the collection of all the specs we're processing.