Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(568)

Unified Diff: src/main.cpp

Issue 982403002: Subzero: Switch file reading to be based on a DataStreamer and MemoryObject. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: cleanup Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« src/PNaClTranslator.cpp ('K') | « src/PNaClTranslator.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/main.cpp
diff --git a/src/main.cpp b/src/main.cpp
index 8ced212e434820ecfc53ae85a46cf926d3deac9f..22ab0a100bb025ac73436f1b950aa17a556804ca 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -26,6 +26,7 @@
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/raw_os_ostream.h"
#include "llvm/Support/SourceMgr.h"
+#include "llvm/Support/StreamingMemoryObject.h"
#include "IceCfg.h"
#include "IceClFlags.h"
@@ -379,7 +380,17 @@ int main(int argc, char **argv) {
if (BuildOnRead) {
std::unique_ptr<Ice::PNaClTranslator> PTranslator(
new Ice::PNaClTranslator(&Ctx));
- PTranslator->translate(IRFilename);
+ std::string StrError;
+ std::unique_ptr<DataStreamer> FileStreamer(
+ getDataFileStreamer(IRFilename, &StrError));
+ if (!StrError.empty() || !FileStreamer) {
+ SMDiagnostic Err(IRFilename, SourceMgr::DK_Error, StrError);
+ Err.print(argv[0], errs());
+ return GetReturnValue(Ice::EC_Bitcode);
+ }
+ std::unique_ptr<StreamingMemoryObject> MemObj(
+ new StreamingMemoryObjectImpl(FileStreamer.release()));
+ PTranslator->translate(IRFilename, std::move(MemObj));
Translator.reset(PTranslator.release());
} else if (ALLOW_LLVM_IR) {
// Parse the input LLVM IR file into a module.
« src/PNaClTranslator.cpp ('K') | « src/PNaClTranslator.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698