示例#1
0
文件: bitcode.cpp 项目: Echelon9/mesa
std::string
clover::llvm::print_module_bitcode(const ::llvm::Module &mod) {
   std::string s;
   ::llvm::raw_string_ostream os { s };
   mod.print(os, NULL);
   return os.str();
}
示例#2
0
bool
IRDynamicChecks::runOnModule(llvm::Module &M)
{
    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));

    llvm::Function* function = M.getFunction(StringRef(m_func_name.c_str()));

    if (!function)
    {
        if (log)
            log->Printf("Couldn't find %s() in the module", m_func_name.c_str());

        return false;
    }

    if (m_checker_functions.m_valid_pointer_check)
    {
        ValidPointerChecker vpc(M, m_checker_functions);

        if (!vpc.Inspect(*function))
            return false;

        if (!vpc.Instrument())
            return false;
    }

    if (m_checker_functions.m_objc_object_check)
    {
        ObjcObjectChecker ooc(M, m_checker_functions);

        if (!ooc.Inspect(*function))
            return false;

        if (!ooc.Instrument())
            return false;
    }

    if (log && log->GetVerbose())
    {
        std::string s;
        raw_string_ostream oss(s);

        M.print(oss, nullptr);

        oss.flush();

        log->Printf ("Module after dynamic checks: \n%s", s.c_str());
    }

    return true;
}
示例#3
0
void compile_llvm_module_to_llvm_assembly(llvm::Module &module, Internal::LLVMOStream& out) {
    module.print(out, nullptr);
}
 void ClangInternalState::printLLVMModule(llvm::raw_ostream& Out,
                                          llvm::Module& M,
                                          CodeGenerator& CG) {
   M.print(Out, /*AssemblyAnnotationWriter*/ 0);
   CG.print(Out);
 }
示例#5
0
 void ClangInternalState::printLLVMModule(llvm::raw_ostream& Out, 
                                          llvm::Module& M) {
   M.print(Out, /*AssemblyAnnotationWriter*/ 0);
 }