Open an IR with function information in an auxiliary data store and print every function along with the number of other functions it calls.
#include <boost/uuid/uuid_io.hpp>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
auto Flags = Os.flags();
Os << "0x" << std::hex << std::setw(8) << std::setfill('0') << uint64_t(A);
Os.flags(Flags);
return Os;
}
void register_aux_data_types() {
AuxDataContainer::registerAuxDataType<FunctionEntries>();
AuxDataContainer::registerAuxDataType<FunctionBlocks>();
}
int main(int argc, char** argv) {
register_aux_data_types();
if (argc == 2) {
std::ifstream in(argv[1]);
I = *IoE;
}
if (!I)
return EXIT_FAILURE;
std::cout << boost::uuids::to_string(Function) << "\n";
std::cout << " Entries:\n";
for (auto EntryUUID : Entries) {
assert(EntryNode);
auto EntryBlock = dyn_cast_or_null<CodeBlock>(EntryNode);
assert(EntryBlock);
std::cout << " " << EntryBlock->getAddress() << "\n";
}
std::cout << " Blocks:\n";
auto& Blocks = It->second;
for (auto BlockUUID : Blocks) {
assert(BlockNode);
auto Block = dyn_cast_or_null<CodeBlock>(BlockNode);
assert(Block);
std::cout << " " << Block->getAddress() << "\n";
}
}
return EXIT_SUCCESS;
}