forked from OSchip/llvm-project
Two Changes:
- Pass the output stream to the analyzer so it can write its output there directly instead of buffering it. - Don't pass a boolean to ParseBytecode because its not needed any more. llvm-svn: 15983
This commit is contained in:
parent
8631bc3aaa
commit
6639333f20
|
@ -58,7 +58,7 @@ BytecodeFileReader::BytecodeFileReader(const std::string &Filename,
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Parse the bytecode we mmapped in
|
// Parse the bytecode we mmapped in
|
||||||
ParseBytecode(Buffer, Length, Filename, H != 0);
|
ParseBytecode(Buffer, Length, Filename);
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
UnmapFileFromAddressSpace(Buffer, Length);
|
UnmapFileFromAddressSpace(Buffer, Length);
|
||||||
throw;
|
throw;
|
||||||
|
@ -114,7 +114,7 @@ BytecodeBufferReader::BytecodeBufferReader(const unsigned char *Buf,
|
||||||
MustDelete = false;
|
MustDelete = false;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
ParseBytecode(ParseBegin, Length, ModuleID, H != 0);
|
ParseBytecode(ParseBegin, Length, ModuleID);
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
if (MustDelete) delete [] Buffer;
|
if (MustDelete) delete [] Buffer;
|
||||||
throw;
|
throw;
|
||||||
|
@ -163,7 +163,7 @@ BytecodeStdinReader::BytecodeStdinReader( BytecodeHandler* H )
|
||||||
throw std::string("Standard Input empty!");
|
throw std::string("Standard Input empty!");
|
||||||
|
|
||||||
FileBuf = &FileData[0];
|
FileBuf = &FileData[0];
|
||||||
ParseBytecode(FileBuf, FileData.size(), "<stdin>", H != 0 );
|
ParseBytecode(FileBuf, FileData.size(), "<stdin>");
|
||||||
}
|
}
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
@ -292,12 +292,15 @@ Module *llvm::ParseBytecodeFile(const std::string &Filename,
|
||||||
}
|
}
|
||||||
|
|
||||||
// AnalyzeBytecodeFile - analyze one file
|
// AnalyzeBytecodeFile - analyze one file
|
||||||
Module* llvm::AnalyzeBytecodeFile(const std::string &Filename,
|
Module* llvm::AnalyzeBytecodeFile(
|
||||||
BytecodeAnalysis& bca,
|
const std::string &Filename, ///< File to analyze
|
||||||
std::string *ErrorStr)
|
BytecodeAnalysis& bca, ///< Statistical output
|
||||||
|
std::string *ErrorStr, ///< Error output
|
||||||
|
std::ostream* output ///< Dump output
|
||||||
|
)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
BytecodeHandler* analyzerHandler = createBytecodeAnalyzerHandler(bca);
|
BytecodeHandler* analyzerHandler = createBytecodeAnalyzerHandler(bca,output);
|
||||||
std::auto_ptr<ModuleProvider> AMP(
|
std::auto_ptr<ModuleProvider> AMP(
|
||||||
getBytecodeModuleProvider(Filename,analyzerHandler));
|
getBytecodeModuleProvider(Filename,analyzerHandler));
|
||||||
return AMP->releaseModule();
|
return AMP->releaseModule();
|
||||||
|
@ -309,15 +312,16 @@ Module* llvm::AnalyzeBytecodeFile(const std::string &Filename,
|
||||||
|
|
||||||
// AnalyzeBytecodeBuffer - analyze a buffer
|
// AnalyzeBytecodeBuffer - analyze a buffer
|
||||||
Module* llvm::AnalyzeBytecodeBuffer(
|
Module* llvm::AnalyzeBytecodeBuffer(
|
||||||
const unsigned char* Buffer, ///< Pointer to start of bytecode buffer
|
const unsigned char* Buffer, ///< Pointer to start of bytecode buffer
|
||||||
unsigned Length, ///< Size of the bytecode buffer
|
unsigned Length, ///< Size of the bytecode buffer
|
||||||
const std::string& ModuleID, ///< Identifier for the module
|
const std::string& ModuleID, ///< Identifier for the module
|
||||||
BytecodeAnalysis& bca, ///< The results of the analysis
|
BytecodeAnalysis& bca, ///< The results of the analysis
|
||||||
std::string* ErrorStr ///< Errors, if any.
|
std::string* ErrorStr, ///< Errors, if any.
|
||||||
)
|
std::ostream* output ///< Dump output, if any
|
||||||
|
)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
BytecodeHandler* hdlr = createBytecodeAnalyzerHandler(bca);
|
BytecodeHandler* hdlr = createBytecodeAnalyzerHandler(bca, output);
|
||||||
std::auto_ptr<ModuleProvider>
|
std::auto_ptr<ModuleProvider>
|
||||||
AMP(getBytecodeBufferModuleProvider(Buffer, Length, ModuleID, hdlr));
|
AMP(getBytecodeBufferModuleProvider(Buffer, Length, ModuleID, hdlr));
|
||||||
return AMP->releaseModule();
|
return AMP->releaseModule();
|
||||||
|
|
Loading…
Reference in New Issue