[llvm-commits] CVS: llvm/tools/lto/lto.cpp
Bill Wendling
isanbard at gmail.com
Wed Feb 7 17:48:51 PST 2007
Done. Thanks for catching that. :-)
-bw
On 2/7/07, Devang Patel <dpatel at apple.com> wrote:
>
>
> On Feb 7, 2007, at 5:41 PM, Bill Wendling wrote:
>
>
> CodeGenPasses->add(new
> TargetData(*Target->getTargetData()));
>
> -
> Target->addPassesToEmitFile(*CodeGenPasses, Out,
> TargetMachine::AssemblyFile,
>
> - true);
>
> +
>
> + MachineCodeEmitter *MCE = 0;
>
> +
>
> + switch
> (Target->addPassesToEmitFile(*CodeGenPasses,
> Out,
>
> + TargetMachine::AssemblyFile, true)) {
>
> + default:
>
> + assert(0 && "Invalid file model!");
>
> + return LTO_UNKNOWN;
>
> + case FileModel::Error:
>
> + // FIXME: Error...
>
> + return LTO_UNKNOWN;
>
> + case FileModel::AsmFile:
>
> + break;
>
> + case FileModel::MachOFile:
>
> + MCE = AddMachOWriter(*CodeGenPasses, Out, *Target);
>
> + break;
>
> + case FileModel::ElfFile:
>
> + MCE = AddELFWriter(*CodeGenPasses, Out, *Target);
>
> + break;
>
> + }
>
> +
>
> + if
> (Target->addPassesToEmitFileFinish(*CodeGenPasses, MCE,
> true)) {
>
> + // FIXME: Error...
>
> + return LTO_UNKNOWN;
>
> + }
> Please avoid assert() in lto. Let linker handle all failures.
> Use LTO_WRITE_FAILURE instead of LTO_UNKNOWN.
>
> Thanks,
> -
> Devang
More information about the llvm-commits
mailing list