Skip to content

Fix the arguments to WriteBitcodeToFile function#134

Open
0xBUGSPRAY wants to merge 1 commit intoSVF-tools:masterfrom
0xBUGSPRAY:patch-1
Open

Fix the arguments to WriteBitcodeToFile function#134
0xBUGSPRAY wants to merge 1 commit intoSVF-tools:masterfrom
0xBUGSPRAY:patch-1

Conversation

@0xBUGSPRAY
Copy link
Copy Markdown

@0xBUGSPRAY 0xBUGSPRAY commented Jun 30, 2019

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);

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

Error details:
razzer/tools/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);
@yuleisui
Copy link
Copy Markdown
Collaborator

Is this the fix for the latest LLVM-8.0?

@0xBUGSPRAY
Copy link
Copy Markdown
Author

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

@yuleisui
Copy link
Copy Markdown
Collaborator

yuleisui commented Jul 3, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants