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

Side by Side Diff: tools/pnacl-thaw/pnacl-thaw.cpp

Issue 770853002: Fix error reporting in the PNaCl bitcode reader. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-llvm.git@master
Patch Set: Fix nits. Created 6 years 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 unified diff | Download patch
« tools/llvm-nm/llvm-nm.cpp ('K') | « tools/pnacl-llc/pnacl-llc.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* Copyright 2013 The Native Client Authors. All rights reserved. 1 /* Copyright 2013 The Native Client Authors. All rights reserved.
2 * Use of this source code is governed by a BSD-style license that can 2 * Use of this source code is governed by a BSD-style license that can
3 * be found in the LICENSE file. 3 * be found in the LICENSE file.
4 */ 4 */
5 5
6 //===-- pnacl-thaw.cpp - The low-level NaCl bitcode thawer ----------------===// 6 //===-- pnacl-thaw.cpp - The low-level NaCl bitcode thawer ----------------===//
7 // 7 //
8 //===----------------------------------------------------------------------===// 8 //===----------------------------------------------------------------------===//
9 // 9 //
10 // Converts NaCl wire format back to LLVM bitcode. 10 // Converts NaCl wire format back to LLVM bitcode.
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 DataStreamer *streamer = getDataFileStreamer(InputFilename, &ErrorMessage); 67 DataStreamer *streamer = getDataFileStreamer(InputFilename, &ErrorMessage);
68 std::unique_ptr<StreamingMemoryObject> Buffer( 68 std::unique_ptr<StreamingMemoryObject> Buffer(
69 new StreamingMemoryObjectImpl(streamer)); 69 new StreamingMemoryObjectImpl(streamer));
70 if (streamer) { 70 if (streamer) {
71 std::string DisplayFilename; 71 std::string DisplayFilename;
72 if (InputFilename == "-") 72 if (InputFilename == "-")
73 DisplayFilename = "<stdin>"; 73 DisplayFilename = "<stdin>";
74 else 74 else
75 DisplayFilename = InputFilename; 75 DisplayFilename = InputFilename;
76 M.reset(getNaClStreamedBitcodeModule(DisplayFilename, Buffer.release(), 76 M.reset(getNaClStreamedBitcodeModule(DisplayFilename, Buffer.release(),
77 Context, &ErrorMessage, 77 Context, /*VerboseErrors=*/false,
jvoung (off chromium) 2014/12/01 23:23:50 Why not set VerboseErrors to true for commandline
Karl 2014/12/03 18:32:10 Done.
78 &ErrorMessage,
78 /*AcceptSupportedOnly=*/false)); 79 /*AcceptSupportedOnly=*/false));
79 if (M.get()) 80 if (M.get())
80 if (std::error_code EC = M->materializeAllPermanently()) { 81 if (std::error_code EC = M->materializeAllPermanently()) {
81 ErrorMessage = EC.message(); 82 ErrorMessage = EC.message();
82 M.reset(); 83 M.reset();
83 } 84 }
84 } 85 }
85 86
86 if (!M.get()) { 87 if (!M.get()) {
87 errs() << argv[0] << ": "; 88 errs() << argv[0] << ": ";
88 if (ErrorMessage.size()) 89 if (ErrorMessage.size())
89 errs() << ErrorMessage << "\n"; 90 errs() << ErrorMessage << "\n";
90 else 91 else
91 errs() << "bitcode didn't read correctly.\n"; 92 errs() << "bitcode didn't read correctly.\n";
92 return 1; 93 return 1;
93 } 94 }
94 95
95 WriteOutputFile(M.get()); 96 WriteOutputFile(M.get());
96 return 0; 97 return 0;
97 } 98 }
OLDNEW
« tools/llvm-nm/llvm-nm.cpp ('K') | « tools/pnacl-llc/pnacl-llc.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698