Index: lib/Bitcode/NaCl/Analysis/NaClBitcodeAnalyzer.cpp |
diff --git a/lib/Bitcode/NaCl/Analysis/NaClBitcodeAnalyzer.cpp b/lib/Bitcode/NaCl/Analysis/NaClBitcodeAnalyzer.cpp |
index 09c507822a4374a8fb97f4fc899b3d277fda8b69..3fc2913a3ebfbc0dec89ef3cf638653c5e7a2374 100644 |
--- a/lib/Bitcode/NaCl/Analysis/NaClBitcodeAnalyzer.cpp |
+++ b/lib/Bitcode/NaCl/Analysis/NaClBitcodeAnalyzer.cpp |
@@ -30,11 +30,15 @@ |
// dumping records, and one for collecting distribution stats for |
// printing. This should simplify the code. |
-/// Error - All bitcode analysis errors go through this function, making this a |
-/// good place to breakpoint if debugging. |
-static bool Error(const llvm::Twine &Err) { |
+namespace { |
+ |
+// Generates an error message when outside parsing, and no |
+// corresponding bit position is known. |
+bool Error(const llvm::Twine &Err) { |
llvm::errs() << Err << "\n"; |
return true; |
+} // End of anonymous namespace. |
+ |
} |
jvoung (off chromium)
2015/03/06 22:30:27
namespace ends down here instead?
Karl
2015/03/06 22:54:20
Oops, fixing.
|
namespace llvm { |
@@ -60,11 +64,6 @@ public: |
virtual ~PNaClBitcodeAnalyzerParser() {} |
- virtual bool Error(const std::string &Message) { |
- // Use local error routine so that all errors are treated uniformly. |
- return ::Error(Message); |
- } |
- |
virtual bool ParseBlock(unsigned BlockID); |
// Returns the string defining the indentation to use with respect |
@@ -247,11 +246,6 @@ protected: |
Indent = Context->GetIndentation(); |
} |
- virtual bool Error(const std::string &Message) { |
- // Use local error routine so that all errors are treated uniformly. |
- return ::Error(Message); |
- } |
- |
// Called once the block has been entered by the bitstream reader. |
// Argument NumWords is set to the number of words in the |
// corresponding block. |
@@ -410,20 +404,20 @@ int AnalyzeBitcodeInBuffer(const std::unique_ptr<MemoryBuffer> &Buf, |
DEBUG(dbgs() << "-> AnalyzeBitcodeInBuffer\n"); |
if (Buf->getBufferSize() & 3) |
- return Error("Bitcode stream should be a multiple of 4 bytes in length"); |
+ return ::Error("Bitcode stream should be a multiple of 4 bytes in length"); |
Karl
2015/03/06 22:54:20
Also removed the "::" because we aren't inside a b
|
const unsigned char *BufPtr = (const unsigned char *)Buf->getBufferStart(); |
const unsigned char *EndBufPtr = BufPtr + Buf->getBufferSize(); |
NaClBitcodeHeader Header; |
if (Header.Read(BufPtr, EndBufPtr)) |
- return Error("Invalid PNaCl bitcode header"); |
+ return ::Error("Invalid PNaCl bitcode header"); |
if (!Header.IsSupported()) |
errs() << "Warning: " << Header.Unsupported() << "\n"; |
if (!Header.IsReadable()) |
- Error("Bitcode file is not readable"); |
+ ::Error("Bitcode file is not readable"); |
NaClBitstreamReader StreamFile(BufPtr, EndBufPtr); |
NaClBitstreamCursor Stream(StreamFile); |
@@ -466,8 +460,8 @@ int AnalyzeBitcodeInFile(const StringRef &InputFilename, raw_ostream &OS, |
ErrorOr<std::unique_ptr<MemoryBuffer>> ErrOrFile = |
MemoryBuffer::getFileOrSTDIN(InputFilename); |
if (std::error_code EC = ErrOrFile.getError()) |
- return Error(Twine("Error reading '") + InputFilename + "': " + |
- EC.message()); |
+ return ::Error(Twine("Error reading '") + InputFilename + "': " + |
+ EC.message()); |
return AnalyzeBitcodeInBuffer(ErrOrFile.get(), OS, DumpOptions); |
} |