From dbd0034c50362cc1dd8eee144e78e183cc49eaf7 Mon Sep 17 00:00:00 2001 From: Shih-wei Liao Date: Fri, 20 Apr 2012 14:27:29 -0700 Subject: Specify the filename upon writing. Change-Id: I5aac9401ab03cc5fa3a6573ef9c9dbdda9163149 --- src/compiler_llvm/compiler_llvm.cc | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'src/compiler_llvm/compiler_llvm.cc') diff --git a/src/compiler_llvm/compiler_llvm.cc b/src/compiler_llvm/compiler_llvm.cc index 894521033d..28320c74c6 100644 --- a/src/compiler_llvm/compiler_llvm.cc +++ b/src/compiler_llvm/compiler_llvm.cc @@ -129,15 +129,8 @@ void CompilerLLVM::EnsureCompilationUnit() { // Allocate compilation unit size_t cunit_idx = cunits_.size(); - curr_cunit_ = new CompilationUnit(insn_set_, cunit_idx); - // Setup bitcode output filename - if (IsBitcodeFileNameAvailable()) { - curr_cunit_->SetBitcodeFileName( - StringPrintf("%s-%zu", bitcode_filename_.c_str(), cunit_idx)); - } - // Register compilation unit cunits_.push_back(curr_cunit_); } @@ -167,7 +160,9 @@ void CompilerLLVM::Materialize() { // Write bitcode to file when filename is set if (IsBitcodeFileNameAvailable()) { - curr_cunit_->WriteBitcodeToFile(); + const size_t cunit_idx = cunits_.size(); + curr_cunit_->WriteBitcodeToFile( + StringPrintf("%s-%zu", bitcode_filename_.c_str(), cunit_idx)); } // Materialize the llvm::Module into ELF object file -- cgit v1.2.3-59-g8ed1b