[llvm-commits] bug fix to get lto-bugpoint to compile

Devang Patel dpatel at apple.com
Fri Oct 10 10:58:29 PDT 2008


Eric,

I applied the patch. Thanks!
Note, lto-bugpoing is not usable it. It is a work in progress.
-
Devang
On Oct 10, 2008, at 1:13 AM, Erick Tryzelaar wrote:

> Good morning. I was trying to build lto-bugpoint this morning, and it
> seems that it was missed in revision 55092 changing the argument types
> for addPassesToEmitFile. This patch copies what happens in llc when
> calling addPassesToEmitFile, so hopefully it's alright. I'm not sure
> how to test this to confirm it works though:
>
>
> diff --git tools/lto-bugpoint/LTOBugPoint.cpp tools/lto-bugpoint/ 
> LTOBugPoint.cpp
> index 587e360..96acf4a 100644
> --- tools/lto-bugpoint/LTOBugPoint.cpp
> +++ tools/lto-bugpoint/LTOBugPoint.cpp
> @@ -24,6 +24,7 @@
> #include "llvm/Target/TargetMachineRegistry.h"
> #include "llvm/Support/SystemUtils.h"
> #include "llvm/Support/MemoryBuffer.h"
> +#include "llvm/Support/raw_ostream.h"
> #include "llvm/Bitcode/ReaderWriter.h"
> #include "llvm/Config/config.h"
> #include <fstream>
> @@ -189,7 +190,13 @@ bool LTOBugPoint::assembleBitcode(llvm::Module
> *M, const char *AsmFileName) {
>   CGPasses->add(new TargetData(*Target->getTargetData()));
>   MachineCodeEmitter* mce = NULL;
>
> -  std::ofstream *Out = new std::ofstream(AsmFileName, std::ios::out);
> +  std::string error;
> +  raw_ostream *Out = new raw_fd_ostream(AsmFileName, error);
> +  if (!error.empty()) {
> +    std::cerr << error << '\n';
> +    delete Out;
> +    return false;
> +  }
>
>   switch (Target->addPassesToEmitFile(*CGPasses, *Out,
>                                       TargetMachine::AssemblyFile,  
> true)) {
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits





More information about the llvm-commits mailing list