From: Reid Spencer Date: Wed, 9 Jun 2004 06:14:52 +0000 (+0000) Subject: Bring some things out of header files that belong only in this file. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=926572c478f5882723d46eac475b99e8f8718a56;p=oota-llvm.git Bring some things out of header files that belong only in this file. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14087 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Bytecode/Analyzer/Parser.cpp b/lib/Bytecode/Analyzer/Parser.cpp index 45f761ea677..743db6c3153 100644 --- a/lib/Bytecode/Analyzer/Parser.cpp +++ b/lib/Bytecode/Analyzer/Parser.cpp @@ -17,6 +17,7 @@ //===----------------------------------------------------------------------===// #include "AnalyzerInternals.h" +#include "ReaderPrimitives.h" #include "llvm/Module.h" #include "llvm/Bytecode/Format.h" #include "Support/StringExtras.h" @@ -25,6 +26,17 @@ using namespace llvm; +// Enable to trace to figure out what the heck is going on when parsing fails +//#define TRACE_LEVEL 10 +//#define DEBUG_OUTPUT + +#if TRACE_LEVEL // ByteCodeReading_TRACEr +#define BCR_TRACE(n, X) \ + if (n < TRACE_LEVEL) std::cerr << std::string(n*2, ' ') << X +#else +#define BCR_TRACE(n, X) +#endif + #define PARSE_ERROR(inserters) \ { \ std::ostringstream errormsg; \ @@ -33,6 +45,15 @@ using namespace llvm; throw std::string(errormsg.str()); \ } + +inline void AbstractBytecodeParser::readBlock(const unsigned char *&Buf, + const unsigned char *EndBuf, + unsigned &Type, unsigned &Size) +{ + Type = read(Buf, EndBuf); + Size = read(Buf, EndBuf); +} + const Type *AbstractBytecodeParser::getType(unsigned ID) { //cerr << "Looking up Type ID: " << ID << "\n"; diff --git a/lib/Bytecode/Reader/Parser.cpp b/lib/Bytecode/Reader/Parser.cpp index 45f761ea677..743db6c3153 100644 --- a/lib/Bytecode/Reader/Parser.cpp +++ b/lib/Bytecode/Reader/Parser.cpp @@ -17,6 +17,7 @@ //===----------------------------------------------------------------------===// #include "AnalyzerInternals.h" +#include "ReaderPrimitives.h" #include "llvm/Module.h" #include "llvm/Bytecode/Format.h" #include "Support/StringExtras.h" @@ -25,6 +26,17 @@ using namespace llvm; +// Enable to trace to figure out what the heck is going on when parsing fails +//#define TRACE_LEVEL 10 +//#define DEBUG_OUTPUT + +#if TRACE_LEVEL // ByteCodeReading_TRACEr +#define BCR_TRACE(n, X) \ + if (n < TRACE_LEVEL) std::cerr << std::string(n*2, ' ') << X +#else +#define BCR_TRACE(n, X) +#endif + #define PARSE_ERROR(inserters) \ { \ std::ostringstream errormsg; \ @@ -33,6 +45,15 @@ using namespace llvm; throw std::string(errormsg.str()); \ } + +inline void AbstractBytecodeParser::readBlock(const unsigned char *&Buf, + const unsigned char *EndBuf, + unsigned &Type, unsigned &Size) +{ + Type = read(Buf, EndBuf); + Size = read(Buf, EndBuf); +} + const Type *AbstractBytecodeParser::getType(unsigned ID) { //cerr << "Looking up Type ID: " << ID << "\n";