summaryrefslogtreecommitdiffstats
path: root/llvm/lib/LTO/LTOModule.cpp
diff options
context:
space:
mode:
authorMehdi Amini <mehdi.amini@apple.com>2015-11-09 02:46:41 +0000
committerMehdi Amini <mehdi.amini@apple.com>2015-11-09 02:46:41 +0000
commit3383ccc4003a685476be4eb5786539648c33ba90 (patch)
tree648d0da37148e341872d478e657c2800c0929bf1 /llvm/lib/LTO/LTOModule.cpp
parent247662b766bb7c60d5cc6ab12eeb30055e5caef4 (diff)
downloadbcm5719-llvm-3383ccc4003a685476be4eb5786539648c33ba90.tar.gz
bcm5719-llvm-3383ccc4003a685476be4eb5786539648c33ba90.zip
Add a method to the BitcodeReader to parse only the identification block
Summary: Mimic parseTriple(); and exposes it to LTOModule.cpp Reviewers: dexonsmith, rafael Subscribers: llvm-commits From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 252442
Diffstat (limited to 'llvm/lib/LTO/LTOModule.cpp')
-rw-r--r--llvm/lib/LTO/LTOModule.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/LTO/LTOModule.cpp b/llvm/lib/LTO/LTOModule.cpp
index ec8991ed236..d28563c23b8 100644
--- a/llvm/lib/LTO/LTOModule.cpp
+++ b/llvm/lib/LTO/LTOModule.cpp
@@ -91,6 +91,15 @@ bool LTOModule::isBitcodeForTarget(MemoryBuffer *Buffer,
return StringRef(Triple).startswith(TriplePrefix);
}
+std::string LTOModule::getProducerString(MemoryBuffer *Buffer) {
+ ErrorOr<MemoryBufferRef> BCOrErr =
+ IRObjectFile::findBitcodeInMemBuffer(Buffer->getMemBufferRef());
+ if (!BCOrErr)
+ return "";
+ LLVMContext Context;
+ return getBitcodeProducerString(*BCOrErr, Context);
+}
+
LTOModule *LTOModule::createFromFile(const char *path, TargetOptions options,
std::string &errMsg) {
ErrorOr<std::unique_ptr<MemoryBuffer>> BufferOrErr =
OpenPOWER on IntegriCloud