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

Unified Diff: lib/IRReader/IRReader.cpp

Issue 1310883003: Install notion of diagnostic handler into PNaCl bitcode readers. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-llvm.git@master
Patch Set: Fix issues in patch set 2. Created 5 years, 4 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
« no previous file with comments | « lib/Bitcode/NaCl/TestUtils/NaClBitcodeTextReader.cpp ('k') | test/NaCl/Bitcode/invalid.test » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/IRReader/IRReader.cpp
diff --git a/lib/IRReader/IRReader.cpp b/lib/IRReader/IRReader.cpp
index fe62715317cd87fc12430177788872529fde0755..f064c668fe85369600c81dacbbd63bb5b190ef60 100644
--- a/lib/IRReader/IRReader.cpp
+++ b/lib/IRReader/IRReader.cpp
@@ -104,11 +104,10 @@ static NaClFileFormat NaClDoAutodetectFileFormat(
return LLVMFormat;
}
-std::unique_ptr<Module> llvm::NaClParseIR(MemoryBufferRef Buffer,
- NaClFileFormat Format,
- SMDiagnostic &Err,
- raw_ostream *Verbose,
- LLVMContext &Context) {
+std::unique_ptr<Module>
+llvm::NaClParseIR(MemoryBufferRef Buffer, NaClFileFormat Format,
+ SMDiagnostic &Err, LLVMContext &Context,
+ DiagnosticHandlerFunction DiagnosticHandler) {
NamedRegionTimer T(TimeIRParsingName, TimeIRParsingGroupName,
TimePassesIsEnabled);
Format = NaClDoAutodetectFileFormat(
@@ -118,7 +117,7 @@ std::unique_ptr<Module> llvm::NaClParseIR(MemoryBufferRef Buffer,
isNaClBitcode((const unsigned char *)Buffer.getBufferStart(),
(const unsigned char *)Buffer.getBufferEnd())) {
ErrorOr<Module *> ModuleOrErr =
- NaClParseBitcodeFile(Buffer, Context, Verbose);
+ NaClParseBitcodeFile(Buffer, Context, DiagnosticHandler);
if (std::error_code EC = ModuleOrErr.getError()) {
Err = SMDiagnostic(Buffer.getBufferIdentifier(), SourceMgr::DK_Error,
EC.message());
@@ -128,7 +127,8 @@ std::unique_ptr<Module> llvm::NaClParseIR(MemoryBufferRef Buffer,
} else if (Format == LLVMFormat) {
if (isBitcode((const unsigned char *)Buffer.getBufferStart(),
(const unsigned char *)Buffer.getBufferEnd())) {
- ErrorOr<Module *> ModuleOrErr = parseBitcodeFile(Buffer, Context);
+ ErrorOr<Module *> ModuleOrErr =
+ parseBitcodeFile(Buffer, Context, DiagnosticHandler);
if (std::error_code EC = ModuleOrErr.getError()) {
Err = SMDiagnostic(Buffer.getBufferIdentifier(), SourceMgr::DK_Error,
EC.message());
@@ -145,11 +145,10 @@ std::unique_ptr<Module> llvm::NaClParseIR(MemoryBufferRef Buffer,
}
}
-std::unique_ptr<Module> llvm::NaClParseIRFile(StringRef Filename,
- NaClFileFormat Format,
- SMDiagnostic &Err,
- raw_ostream *Verbose,
- LLVMContext &Context) {
+std::unique_ptr<Module>
+llvm::NaClParseIRFile(StringRef Filename, NaClFileFormat Format,
+ SMDiagnostic &Err, LLVMContext &Context,
+ DiagnosticHandlerFunction DiagnosticHandler) {
ErrorOr<std::unique_ptr<MemoryBuffer>> FileOrErr =
MemoryBuffer::getFileOrSTDIN(Filename);
if (std::error_code EC = FileOrErr.getError()) {
@@ -158,8 +157,8 @@ std::unique_ptr<Module> llvm::NaClParseIRFile(StringRef Filename,
return nullptr;
}
- return NaClParseIR(FileOrErr.get()->getMemBufferRef(), Format, Err, Verbose,
- Context);
+ return NaClParseIR(FileOrErr.get()->getMemBufferRef(), Format, Err, Context,
+ DiagnosticHandler);
}
// @LOCALMOD-END
« no previous file with comments | « lib/Bitcode/NaCl/TestUtils/NaClBitcodeTextReader.cpp ('k') | test/NaCl/Bitcode/invalid.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698