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

Function getMangledNames

include/ftg/utils/LLVMUtil.h:64–95  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

62}
63
64static inline std::vector<std::string>
65getMangledNames(const clang::NamedDecl &D) {
66 // NOTE: getAllManglings method causes segmentation fault when a specific
67 // instance of CXXMethodDecl is given. To bypass this bug, below logic
68 // is used instead and its reasonable because getAllManglings is used
69 // to get more precise result for constructors and destructors only.
70 // However, from the version where the bug is fixed, it would be desriable to
71 // use getAllMangling for any cases to erase unnecessary conditions.
72 if (llvm::isa<clang::CXXConstructorDecl>(&D) ||
73 llvm::isa<clang::CXXDestructorDecl>(&D)) {
74 auto MangledNames =
75 clang::ASTNameGenerator(D.getASTContext()).getAllManglings(&D);
76 if (MangledNames.size() == 0)
77 MangledNames.emplace_back(D.getNameAsString());
78 return MangledNames;
79 }
80
81 auto MangleCtx = std::unique_ptr<clang::MangleContext>(
82 D.getASTContext().createMangleContext());
83 if (!MangleCtx)
84 return {D.getNameAsString()};
85
86 if (!MangleCtx->shouldMangleDeclName(&D)) {
87 return {D.getNameAsString()};
88 }
89
90 std::string MangledName;
91 llvm::raw_string_ostream OS(MangledName);
92 MangleCtx->mangleName(&D, OS);
93 OS.flush();
94 return {MangledName};
95}
96
97static inline std::string getFullPath(const llvm::DIFile &F) {
98 std::string Name = F.getFilename().str();

Callers 9

findDefinedFunctionDeclsFunction · 0.85
getIRFunctionFunction · 0.85
insertMacroNodeMethod · 0.85
ParamNumberAnalyzerMethod · 0.85
getFuncMethod · 0.85
initializeRDAnalyzerMethod · 0.85
TEST_FFunction · 0.85
analyzeMethod · 0.85
TEST_FFunction · 0.85

Calls 1

sizeMethod · 0.80

Tested by 3

TEST_FFunction · 0.68
analyzeMethod · 0.68
TEST_FFunction · 0.68