aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Luc Brouillet <jeanluc@google.com>2017-02-23 02:07:44 +0000
committerandroid-build-merger <android-build-merger@google.com>2017-02-23 02:07:44 +0000
commite26f228338b9929eeb15534bb438a431ae5b6a90 (patch)
tree595bf2ea442c34dbc58bf385ec3b71458e64b8f0
parenteb5a87db09ecc78875d4edf5f8d3ff2f0157b1a8 (diff)
parentcfb3604f234ce55c4bc2575cfdcf3f8c041fb869 (diff)
downloadlibbcc-e26f228338b9929eeb15534bb438a431ae5b6a90.tar.gz
Merge "Add back version info to Script in libbcc"
am: cfb3604f23 Change-Id: I14ae0a759195d22f0ef1d07eb2620ea834502128
-rw-r--r--include/bcc/Script.h9
-rw-r--r--lib/RSCompilerDriver.cpp1
-rw-r--r--lib/Script.cpp1
3 files changed, 11 insertions, 0 deletions
diff --git a/include/bcc/Script.h b/include/bcc/Script.h
index 62c7369..ad18ac6 100644
--- a/include/bcc/Script.h
+++ b/include/bcc/Script.h
@@ -39,6 +39,9 @@ private:
// TODO(jeanluc) Verify that the lifetime is managed correctly.
Source *mSource;
+ // Currently unused. Will be used in an upcoming CL to fix small_struct bug.
+ unsigned mCompilerVersion;
+
llvm::CodeGenOpt::Level mOptimizationLevel;
RSLinkRuntimeCallback mLinkRuntimeCallback;
@@ -60,6 +63,12 @@ public:
bool LinkRuntime(const char *rt_path);
+ void setCompilerVersion(unsigned pCompilerVersion) {
+ mCompilerVersion = pCompilerVersion;
+ }
+
+ unsigned getCompilerVersion() const { return mCompilerVersion; }
+
void setOptimizationLevel(llvm::CodeGenOpt::Level pOptimizationLevel) {
mOptimizationLevel = pOptimizationLevel;
}
diff --git a/lib/RSCompilerDriver.cpp b/lib/RSCompilerDriver.cpp
index 09c4227..9f04a7f 100644
--- a/lib/RSCompilerDriver.cpp
+++ b/lib/RSCompilerDriver.cpp
@@ -276,6 +276,7 @@ bool RSCompilerDriver::build(BCCContext &pContext,
// Read information from bitcode wrapper.
bcinfo::BitcodeWrapper wrapper(pBitcode, pBitcodeSize);
+ script.setCompilerVersion(wrapper.getCompilerVersion());
script.setOptimizationLevel(static_cast<llvm::CodeGenOpt::Level>(
wrapper.getOptimizationLevel()));
diff --git a/lib/Script.cpp b/lib/Script.cpp
index fad070d..6381b34 100644
--- a/lib/Script.cpp
+++ b/lib/Script.cpp
@@ -26,6 +26,7 @@ using namespace bcc;
Script::Script(Source *pSource)
: mSource(pSource),
+ mCompilerVersion(0),
mOptimizationLevel(llvm::CodeGenOpt::Aggressive),
mLinkRuntimeCallback(nullptr), mEmbedInfo(false), mEmbedGlobalInfo(false),
mEmbedGlobalInfoSkipConstant(false) {}