use dump method instead of Asm/Writer to do debug printing

Rename C to M because C used to be 'Class' and now we are 'Module'


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2151 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2002-04-07 22:34:19 +00:00
parent 25d15a7ff7
commit 06272dcfb2
3 changed files with 21 additions and 18 deletions

View File

@ -11,7 +11,6 @@
#include "llvm/Module.h" #include "llvm/Module.h"
#include "llvm/Assembly/Parser.h" #include "llvm/Assembly/Parser.h"
#include "llvm/Assembly/Writer.h"
#include "llvm/Bytecode/Writer.h" #include "llvm/Bytecode/Writer.h"
#include "Support/CommandLine.h" #include "Support/CommandLine.h"
#include <fstream> #include <fstream>
@ -29,14 +28,16 @@ int main(int argc, char **argv) {
ostream *Out = 0; ostream *Out = 0;
try { try {
// Parse the file now... // Parse the file now...
std::auto_ptr<Module> C(ParseAssemblyFile(InputFilename)); std::auto_ptr<Module> M(ParseAssemblyFile(InputFilename));
if (C.get() == 0) { if (M.get() == 0) {
cerr << "assembly didn't read correctly.\n"; cerr << "assembly didn't read correctly.\n";
return 1; return 1;
} }
if (DumpAsm) if (DumpAsm) {
cerr << "Here's the assembly:\n" << C.get(); cerr << "Here's the assembly:\n";
M.get()->dump();
}
if (OutputFilename != "") { // Specified an output filename? if (OutputFilename != "") { // Specified an output filename?
if (!Force && std::ifstream(OutputFilename.c_str())) { if (!Force && std::ifstream(OutputFilename.c_str())) {
@ -77,7 +78,7 @@ int main(int argc, char **argv) {
return 1; return 1;
} }
WriteBytecodeToFile(C.get(), *Out); WriteBytecodeToFile(M.get(), *Out);
} catch (const ParseException &E) { } catch (const ParseException &E) {
cerr << E.getMessage() << endl; cerr << E.getMessage() << endl;
return 1; return 1;

View File

@ -11,7 +11,6 @@
#include "llvm/Module.h" #include "llvm/Module.h"
#include "llvm/Assembly/Parser.h" #include "llvm/Assembly/Parser.h"
#include "llvm/Assembly/Writer.h"
#include "llvm/Bytecode/Writer.h" #include "llvm/Bytecode/Writer.h"
#include "Support/CommandLine.h" #include "Support/CommandLine.h"
#include <fstream> #include <fstream>
@ -29,14 +28,16 @@ int main(int argc, char **argv) {
ostream *Out = 0; ostream *Out = 0;
try { try {
// Parse the file now... // Parse the file now...
std::auto_ptr<Module> C(ParseAssemblyFile(InputFilename)); std::auto_ptr<Module> M(ParseAssemblyFile(InputFilename));
if (C.get() == 0) { if (M.get() == 0) {
cerr << "assembly didn't read correctly.\n"; cerr << "assembly didn't read correctly.\n";
return 1; return 1;
} }
if (DumpAsm) if (DumpAsm) {
cerr << "Here's the assembly:\n" << C.get(); cerr << "Here's the assembly:\n";
M.get()->dump();
}
if (OutputFilename != "") { // Specified an output filename? if (OutputFilename != "") { // Specified an output filename?
if (!Force && std::ifstream(OutputFilename.c_str())) { if (!Force && std::ifstream(OutputFilename.c_str())) {
@ -77,7 +78,7 @@ int main(int argc, char **argv) {
return 1; return 1;
} }
WriteBytecodeToFile(C.get(), *Out); WriteBytecodeToFile(M.get(), *Out);
} catch (const ParseException &E) { } catch (const ParseException &E) {
cerr << E.getMessage() << endl; cerr << E.getMessage() << endl;
return 1; return 1;

View File

@ -11,7 +11,6 @@
#include "llvm/Module.h" #include "llvm/Module.h"
#include "llvm/Assembly/Parser.h" #include "llvm/Assembly/Parser.h"
#include "llvm/Assembly/Writer.h"
#include "llvm/Bytecode/Writer.h" #include "llvm/Bytecode/Writer.h"
#include "Support/CommandLine.h" #include "Support/CommandLine.h"
#include <fstream> #include <fstream>
@ -29,14 +28,16 @@ int main(int argc, char **argv) {
ostream *Out = 0; ostream *Out = 0;
try { try {
// Parse the file now... // Parse the file now...
std::auto_ptr<Module> C(ParseAssemblyFile(InputFilename)); std::auto_ptr<Module> M(ParseAssemblyFile(InputFilename));
if (C.get() == 0) { if (M.get() == 0) {
cerr << "assembly didn't read correctly.\n"; cerr << "assembly didn't read correctly.\n";
return 1; return 1;
} }
if (DumpAsm) if (DumpAsm) {
cerr << "Here's the assembly:\n" << C.get(); cerr << "Here's the assembly:\n";
M.get()->dump();
}
if (OutputFilename != "") { // Specified an output filename? if (OutputFilename != "") { // Specified an output filename?
if (!Force && std::ifstream(OutputFilename.c_str())) { if (!Force && std::ifstream(OutputFilename.c_str())) {
@ -77,7 +78,7 @@ int main(int argc, char **argv) {
return 1; return 1;
} }
WriteBytecodeToFile(C.get(), *Out); WriteBytecodeToFile(M.get(), *Out);
} catch (const ParseException &E) { } catch (const ParseException &E) {
cerr << E.getMessage() << endl; cerr << E.getMessage() << endl;
return 1; return 1;