Add BCCContext.
Convention:
* namespace bcc {
/* no space here */class [ClassName] {
...
};
} // end namespace bcc
* Instance variables are prefixed with "m";
* Class variable/method are captialized;
* Local variables in the function are in lower case with underscore;
* Parameters to the function are prefixed with "p";
* Include guard in the header will look like
#ifndef BCC_<sub folder>_<class>_H
* The order of implementation in .cpp is in the order of their
declaration with the following constraints:
i. Class methods go first
ii. Recursively apply this rule to the sub-class
iii. Then the constructor and destructor of the class
iv. And then the instance methods
* The order of includes in Foo.cpp should be:
i. Foo.h should always go first
ii. C headers
iii. C++ headers
iv. LLVM headers
iv. Other headers from the project other than libbcc and Android
frameworks (i.e., f/b/include/utils/)
v. Header files defined in libbcc
vi. Header files from Android frameworks (f/b/include/utils/)
Android frameworks should be included in the last since it
implicitly includes cutils/log.h which may cause LOG_TAG be
defined to NULL if no LOG_TAG hasn't been defined ever before
include it.
* Avoid including STL and LLVM headers in the BCC headers. Some
clients (e.g., RenderScript) may prefer not include the C++ STL
support and don't want to associate with LLVM directly.
BCCContext manages the global data across the libbcc infrastructure.
This includes LLVMContext object required by materialize bitcode into
llvm::Module and LLVM compilation infrastructure.
Furthermore, BCCContext is escalated to be managed in Script instead
of in the SourceInfo.
Change-Id: I60b9da7b5c61f6c684dcf981ba5abaf066e3c883
diff --git a/lib/ExecutionEngine/Script.h b/lib/ExecutionEngine/Script.h
index e95cf8a..4534951 100644
--- a/lib/ExecutionEngine/Script.h
+++ b/lib/ExecutionEngine/Script.h
@@ -20,6 +20,7 @@
#include <bcc/bcc.h>
#include "bcc_internal.h"
+#include "BCCContext.h"
#include "Compiler.h"
#include <llvm/Support/CodeGen.h>
@@ -59,6 +60,8 @@
class Script {
private:
+ BCCContext mContext;
+
int mErrorCode;
ScriptStatus::StatusType mStatus;