[llvm-commits] CVS: llvm/tools/gccld/GenerateCode.cpp gccld.cpp gccld.h
Reid Spencer
reid at x10sys.com
Sun Aug 20 23:05:02 PDT 2006
Changes in directory llvm/tools/gccld:
GenerateCode.cpp updated: 1.59 -> 1.60
gccld.cpp updated: 1.108 -> 1.109
gccld.h updated: 1.18 -> 1.19
---
Log message:
For PR797: http://llvm.org/PR797 :
Adjust usage of the ExecuteAndWait function to use the last argument which
is the ErrMsg string. This is necessitated because this function no longer
throws exceptions on error.
---
Diffs of the changes: (+32 -10)
GenerateCode.cpp | 10 +++++++---
gccld.cpp | 29 ++++++++++++++++++++++-------
gccld.h | 3 +++
3 files changed, 32 insertions(+), 10 deletions(-)
Index: llvm/tools/gccld/GenerateCode.cpp
diff -u llvm/tools/gccld/GenerateCode.cpp:1.59 llvm/tools/gccld/GenerateCode.cpp:1.60
--- llvm/tools/gccld/GenerateCode.cpp:1.59 Tue Aug 1 13:04:01 2006
+++ llvm/tools/gccld/GenerateCode.cpp Mon Aug 21 01:04:45 2006
@@ -297,6 +297,7 @@
int llvm::GenerateAssembly(const std::string &OutputFilename,
const std::string &InputFilename,
const sys::Path &llc,
+ std::string& ErrMsg,
bool Verbose) {
// Run LLC to convert the bytecode file into assembly code.
std::vector<const char*> args;
@@ -307,13 +308,14 @@
args.push_back(InputFilename.c_str());
args.push_back(0);
if (Verbose) dumpArgs(&args[0]);
- return sys::Program::ExecuteAndWait(llc, &args[0]);
+ return sys::Program::ExecuteAndWait(llc, &args[0],0,0,0,&ErrMsg);
}
/// GenerateCFile - generates a C source file from the specified bytecode file.
int llvm::GenerateCFile(const std::string &OutputFile,
const std::string &InputFile,
const sys::Path &llc,
+ std::string& ErrMsg,
bool Verbose) {
// Run LLC to convert the bytecode file into C.
std::vector<const char*> args;
@@ -325,7 +327,7 @@
args.push_back(InputFile.c_str());
args.push_back(0);
if (Verbose) dumpArgs(&args[0]);
- return sys::Program::ExecuteAndWait(llc, &args[0]);
+ return sys::Program::ExecuteAndWait(llc, &args[0],0,0,0,&ErrMsg);
}
/// GenerateNative - generates a native executable file from the specified
@@ -352,6 +354,7 @@
bool ExportAllAsDynamic,
const std::vector<std::string> &RPaths,
const std::string &SOName,
+ std::string& ErrMsg,
bool Verbose) {
// Remove these environment variables from the environment of the
// programs that we will execute. It appears that GCC sets these
@@ -436,7 +439,8 @@
// Run the compiler to assembly and link together the program.
if (Verbose) dumpArgs(&args[0]);
- int Res = sys::Program::ExecuteAndWait(gcc, &args[0],(const char**)clean_env);
+ int Res = sys::Program::ExecuteAndWait(
+ gcc, &args[0],(const char**)clean_env,0,0,&ErrMsg);
delete [] clean_env;
Index: llvm/tools/gccld/gccld.cpp
diff -u llvm/tools/gccld/gccld.cpp:1.108 llvm/tools/gccld/gccld.cpp:1.109
--- llvm/tools/gccld/gccld.cpp:1.108 Mon Jan 9 21:14:40 2006
+++ llvm/tools/gccld/gccld.cpp Mon Aug 21 01:04:45 2006
@@ -320,12 +320,19 @@
// Generate an assembly language file for the bytecode.
if (Verbose) std::cout << "Generating Assembly Code\n";
- GenerateAssembly(AssemblyFile.toString(), RealBytecodeOutput, llc,
- Verbose);
+ std::string ErrMsg;
+ if (0 != GenerateAssembly(
+ AssemblyFile.toString(), RealBytecodeOutput, llc, ErrMsg, Verbose)) {
+ std::cerr << argv[0] << ": " << ErrMsg << "\n";
+ return 2;
+ }
if (Verbose) std::cout << "Generating Native Code\n";
- GenerateNative(OutputFilename, AssemblyFile.toString(),
+ if (0 != GenerateNative(OutputFilename, AssemblyFile.toString(),
LibPaths, Libraries, gcc, envp, LinkAsLibrary,
- NoInternalize, RPath, SOName, Verbose);
+ NoInternalize, RPath, SOName, ErrMsg, Verbose) ) {
+ std::cerr << argv[0] << ": " << ErrMsg << "\n";
+ return 2;
+ }
if (!SaveTemps) {
// Remove the assembly language file.
@@ -353,11 +360,19 @@
// Generate an assembly language file for the bytecode.
if (Verbose) std::cout << "Generating C Source Code\n";
- GenerateCFile(CFile.toString(), RealBytecodeOutput, llc, Verbose);
+ std::string ErrMsg;
+ if (0 != GenerateCFile(
+ CFile.toString(), RealBytecodeOutput, llc, ErrMsg, Verbose)) {
+ std::cerr << argv[0] << ": " << ErrMsg << "\n";
+ return 2;
+ }
if (Verbose) std::cout << "Generating Native Code\n";
- GenerateNative(OutputFilename, CFile.toString(),
+ if (0 != GenerateNative(OutputFilename, CFile.toString(),
LibPaths, Libraries, gcc, envp, LinkAsLibrary,
- NoInternalize, RPath, SOName, Verbose);
+ NoInternalize, RPath, SOName, ErrMsg, Verbose)) {
+ std::cerr << argv[0] << ": " << ErrMsg << "\n";
+ return 2;
+ }
if (!SaveTemps) {
// Remove the assembly language file.
Index: llvm/tools/gccld/gccld.h
diff -u llvm/tools/gccld/gccld.h:1.18 llvm/tools/gccld/gccld.h:1.19
--- llvm/tools/gccld/gccld.h:1.18 Wed Dec 21 19:50:56 2005
+++ llvm/tools/gccld/gccld.h Mon Aug 21 01:04:45 2006
@@ -30,12 +30,14 @@
GenerateAssembly (const std::string &OutputFilename,
const std::string &InputFilename,
const sys::Path &llc,
+ std::string& ErrMsg,
bool Verbose=false);
int
GenerateCFile (const std::string &OutputFile,
const std::string &InputFile,
const sys::Path &llc,
+ std::string& ErrMsg,
bool Verbose=false);
int
GenerateNative (const std::string &OutputFilename,
@@ -48,6 +50,7 @@
bool ExportAllAsDynamic,
const std::vector<std::string> &RPath,
const std::string &SOName,
+ std::string& ErrMsg,
bool Verbose=false);
} // End llvm namespace
More information about the llvm-commits
mailing list