Static Value-Flow Analysis
Loading...
Searching...
No Matches
SVF::cppUtil::ItaniumABI Class Reference

#include <CppUtil.h>

Inheritance diagram for SVF::cppUtil::ItaniumABI:
SVF::cppUtil::CXXABI

Public Member Functions

bool isVtable (const std::string &name) override
bool isTypeInfo (const std::string &name) override
bool isConstructor (const std::string &name) override
bool isDestructor (const std::string &name) override
std::string extractClassName (const std::string &name) override
DemangledName demangle (const std::string &name) override
Public Member Functions inherited from SVF::cppUtil::CXXABI
virtual ~CXXABI ()=default

Detailed Description

Definition at line 66 of file CppUtil.h.

Member Function Documentation

◆ demangle()

DemangledName SVF::cppUtil::ItaniumABI::demangle ( const std::string & name)
overridevirtual

Implements SVF::cppUtil::CXXABI.

Definition at line 1086 of file CppUtil.cpp.

1087{
1088 DemangledName dname;
1089 dname.isThunkFunc = false;
1090
1091 std::string realnameStr = llvm::demangle(name);
1092 if (realnameStr == name)
1093 {
1094 dname.className = "";
1095 dname.funcName = "";
1096 }
1097 else
1098 {
1099 std::string beforeParenthesis = getBeforeParenthesis(realnameStr);
1100 if (beforeParenthesis.find("::") == std::string::npos ||
1101 isOperOverload(beforeParenthesis))
1102 {
1103 dname.className = "";
1104 dname.funcName = "";
1105 }
1106 else
1107 {
1108 std::string beforeBracket = getBeforeBrackets(beforeParenthesis);
1109 size_t colon = beforeBracket.rfind("::");
1110 if (colon == std::string::npos)
1111 {
1112 dname.className = "";
1113 dname.funcName = "";
1114 }
1115 else
1116 {
1117 dname.className = beforeParenthesis.substr(0, colon);
1118 dname.funcName = beforeParenthesis.substr(colon + 2);
1119 }
1120 }
1121 }
1122
1123 handleThunkFunction(dname);
1124
1125 return dname;
1126}
static void handleThunkFunction(cppUtil::DemangledName &dname)
Definition CppUtil.cpp:146
static bool isOperOverload(const std::string &name)
Definition CppUtil.cpp:84
static std::string getBeforeParenthesis(const std::string &name)
Definition CppUtil.cpp:107
const char *const name
Definition cJSON.h:264
std::string getBeforeBrackets(const std::string &name)
Definition CppUtil.cpp:127

◆ extractClassName()

std::string SVF::cppUtil::ItaniumABI::extractClassName ( const std::string & name)
overridevirtual

Implements SVF::cppUtil::CXXABI.

Definition at line 1071 of file CppUtil.cpp.

1072{
1073 std::string className = "";
1074 std::string realnameStr = llvm::demangle(name);
1075 if (realnameStr != name)
1076 {
1077 if (realnameStr.compare(0, vtblLabelAfterDemangle.size(),
1079 {
1080 className = realnameStr.substr(vtblLabelAfterDemangle.size());
1081 }
1082 }
1083 return className;
1084}
const std::string vtblLabelAfterDemangle
Definition CppUtil.cpp:43

◆ isConstructor()

bool SVF::cppUtil::ItaniumABI::isConstructor ( const std::string & name)
overridevirtual

Implements SVF::cppUtil::CXXABI.

Definition at line 1038 of file CppUtil.cpp.

1039{
1040 if (name.compare(0, vfunPreLabel.size(), vfunPreLabel) != 0)
1041 {
1042 return false;
1043 }
1044 cppUtil::DemangledName dname = demangle(name);
1045 if (dname.className.size() == 0)
1046 {
1047 return false;
1048 }
1050 return dname.className.size() > 0 && dname.className == dname.funcName;
1051}
void stripBracketsAndNamespace(cppUtil::DemangledName &dname)
Definition CppUtil.cpp:505
const std::string vfunPreLabel
Definition CppUtil.cpp:53
DemangledName demangle(const std::string &name) override
Definition CppUtil.cpp:1086

◆ isDestructor()

bool SVF::cppUtil::ItaniumABI::isDestructor ( const std::string & name)
overridevirtual

Implements SVF::cppUtil::CXXABI.

Definition at line 1053 of file CppUtil.cpp.

1054{
1055 if (name.compare(0, vfunPreLabel.size(), vfunPreLabel) != 0)
1056 {
1057 return false;
1058 }
1059 cppUtil::DemangledName dname = demangle(name);
1060 if (dname.className.size() == 0)
1061 {
1062 return false;
1063 }
1065 return (dname.className.size() > 0 && dname.funcName.size() > 0 &&
1066 dname.className.size() + 1 == dname.funcName.size() &&
1067 dname.funcName.compare(0, 1, "~") == 0 &&
1068 dname.className.compare(dname.funcName.substr(1)) == 0);
1069}

◆ isTypeInfo()

bool SVF::cppUtil::ItaniumABI::isTypeInfo ( const std::string & name)
overridevirtual

Implements SVF::cppUtil::CXXABI.

Definition at line 1033 of file CppUtil.cpp.

1034{
1035 return name.compare(0, ztilabel.size(), ztilabel) == 0;
1036}
const std::string ztilabel
Definition CppUtil.cpp:79

◆ isVtable()

bool SVF::cppUtil::ItaniumABI::isVtable ( const std::string & name)
overridevirtual

Implements SVF::cppUtil::CXXABI.

Definition at line 1027 of file CppUtil.cpp.

1028{
1029 return name.compare(0, vtblLabelBeforeDemangle.size(),
1031}
const std::string vtblLabelBeforeDemangle
Definition CppUtil.cpp:50

The documentation for this class was generated from the following files: