Author: reid Date: Thu Aug 16 02:47:30 2007 New Revision: 41121 URL: http://llvm.org/viewvc/llvm-project?rev=41121&view=rev Log: Improve error handling in the linker by:
1. Eliminate redundant error messages. LinkInFile and LinkInArchive already call the error() method in each case so there's no use telling the user again that an item couldn't be linked in. 2. Improve the formatting of error messages (separating content). 3. Change the wording for the warning about unrecognized files. Make it clear that the file is being ignored. Modified: llvm/trunk/lib/Linker/LinkItems.cpp Modified: llvm/trunk/lib/Linker/LinkItems.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Linker/LinkItems.cpp?rev=41121&r1=41120&r2=41121&view=diff ============================================================================== --- llvm/trunk/lib/Linker/LinkItems.cpp (original) +++ llvm/trunk/lib/Linker/LinkItems.cpp Thu Aug 16 02:47:30 2007 @@ -87,7 +87,7 @@ case sys::Bitcode_FileType: // LLVM ".so" file. if (LinkInFile(Pathname, is_native)) - return error("Cannot link file '" + Pathname.toString() + "'"); + return true; break; case sys::Archive_FileType: @@ -180,24 +180,24 @@ switch (sys::IdentifyFileType(Magic.c_str(), 64)) { default: assert(0 && "Bad file type identification"); case sys::Unknown_FileType: - return warning("Supposed object file '" + File.toString() + - "' not recognized as such"); + return warning("Ignoring file '" + File.toString() + + "' because does not contain bitcode."); case sys::Archive_FileType: // A user may specify an ar archive without -l, perhaps because it // is not installed as a library. Detect that and link the archive. verbose("Linking archive file '" + File.toString() + "'"); if (LinkInArchive(File, is_native)) - return error("Cannot link archive '" + File.toString() + "'"); + return true; break; case sys::Bitcode_FileType: { verbose("Linking bitcode file '" + File.toString() + "'"); std::auto_ptr<Module> M(LoadObject(File)); if (M.get() == 0) - return error("Cannot load file '" + File.toString() + "'" + Error); + return error("Cannot load file '" + File.toString() + "': " + Error); if (LinkInModule(M.get(), &Error)) - return error("Cannot link file '" + File.toString() + "'" + Error); + return error("Cannot link file '" + File.toString() + "': " + Error); verbose("Linked in file '" + File.toString() + "'"); break; _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits