MCPcopy Create free account
hub / github.com/Samsung/UTopia / TEST_F

Function TEST_F

tests/utils/TestLLVMUtil.cpp:31–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29};
30
31TEST_F(TestLLVMUtil, GetCalledFunction_GeneralP) {
32 const std::string Code = "extern \"C\" {\n"
33 " void API();\n"
34 " void test() { API(); }\n"
35 "}";
36 SourceFileManager SFM;
37 SFM.createFile("test.cpp", Code);
38 ASSERT_TRUE(load(SFM.getSrcDirPath(), SFM.getFilePath("test.cpp")));
39 const auto *CB = llvm::dyn_cast_or_null<llvm::CallBase>(
40 IRAccess->getInstruction("test", 0, 0));
41 ASSERT_TRUE(CB);
42 const auto *CF = util::getCalledFunction(*CB);
43 ASSERT_TRUE(CF);
44 ASSERT_EQ(CF->getName(), "API");
45}
46
47TEST_F(TestLLVMUtil, GetCalledFunction_IndirectN) {
48 const std::string Code = "extern \"C\" {\n"

Callers

nothing calls this directly

Calls 6

getCalledFunctionFunction · 0.85
getSrcDirPathMethod · 0.80
getInstructionMethod · 0.80
createFileMethod · 0.45
getFilePathMethod · 0.45
getNameMethod · 0.45

Tested by

no test coverage detected