SVF icon indicating copy to clipboard operation
SVF copied to clipboard

Fix the arguments to WriteBitcodeToFile function

Open 0xBUGSPRAY opened this issue 5 years ago • 3 comments

WriteBitcodeToFile expectes reference to the Module object: https://llvm.org/doxygen/BitcodeWriter_8cpp_source.html#l04360

Error details: ~/SVF/lib/Util/SVFModule.cpp:371:36: error: cannot convert 'llvm::Module' to 'const llvm::Module*' for argument '1' to 'void llvm::WriteBitcodeToFile(const llvm::Module*, llvm::raw_ostream&, bool, const llvm::ModuleSummaryIndex*, bool, llvm::ModuleHash*)' WriteBitcodeToFile(*mod, OS);

0xBUGSPRAY avatar Jun 30 '19 09:06 0xBUGSPRAY

Is this the fix for the latest LLVM-8.0?

yuleisui avatar Jun 30 '19 09:06 yuleisui

This fix is for LLVM-6.0 and 7.0. Didn't check for 8.0 which is unsupported for SVF I suppose?

0xBUGSPRAY avatar Jul 01 '19 09:07 0xBUGSPRAY

For a successful compilation, it needs to pass the reference "*mod" but not "mod", otherwise it would be the compilation errors below:

/lib/Util/SVFModule.cpp:  error: error: no matchingno  functionmatching  for function  call for
       callto
       'WriteBitcodeToFile'to 
'WriteBitcodeToFile'
        WriteBitcodeToFile(mod, OS);
        WriteBitcodeToFile(mod, OS);
        ^~~~~~~~~~~~~~~~~~
        ^~~~~~~~~~~~~~~~~~
/Users/136884/Documents/workspace/llvm-7.0.0.src/include/llvm/Bitcode/BitcodeWriter.h:129:8/Users/136884/Documents/workspace/llvm-7.0.0.src/include/llvm/Bitcode/BitcodeWriter.h:: 129:8note::  candidate
note      : function candidatenot
       viable:function  nonot  knownviable:  conversionno  fromknown  'Module *'conversion  (aka 'llvm::Module *')from  to'Module *'  'const llvm::Module'(aka 'llvm::Module *')
       tofor  'const llvm::Module'1st
       argument;for  dereference1st  theargument;  argumentdereference  withthe  *argument 
with *
  void WriteBitcodeToFile(const Module &M, raw_ostream &Out,
       ^  void WriteBitcodeToFile(const Module &M, raw_ostream &Out,

       ^
1 error1 generated.
 error generated.
make[2]: make[2]: *** [lib/CMakeFiles/LLVMSvf.dir/Util/SVFModule.cpp.o] Error 1*** [lib/CMakeFiles/Svf.dir/Util/SVFModule.cpp.o] Error 1

yuleisui avatar Jul 03 '19 23:07 yuleisui