-
Notifications
You must be signed in to change notification settings - Fork 440
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Converts a mangled name to C naming style to match functions in extapi.c #1393
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1393 +/- ##
==========================================
- Coverage 67.83% 67.82% -0.01%
==========================================
Files 250 250
Lines 27632 27646 +14
==========================================
+ Hits 18743 18751 +8
- Misses 8889 8895 +6
|
svf-llvm/lib/LLVMModule.cpp
Outdated
@@ -1062,7 +1062,7 @@ void LLVMModuleSet::buildFunToFunMap() | |||
{ | |||
for (const Function* owfunc : overwriteExtFuncs) | |||
{ | |||
if (appfunc->getName().str().compare(owfunc->getName().str()) == 0) | |||
if (LLVMUtil::processMangledName(appfunc->getName().str()).compare(owfunc->getName().str()) == 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Promote this line to outer loop at 1063
svf-llvm/lib/LLVMModule.cpp
Outdated
@@ -1040,7 +1040,7 @@ void LLVMModuleSet::buildFunToFunMap() | |||
std::string declName = fdecl->getName().str(); | |||
// Since C function names cannot include '.', change the function name from llvm.memcpy.p0i8.p0i8.i64 to llvm_memcpy_p0i8_p0i8_i64." | |||
std::replace(declName.begin(), declName.end(), '.', '_'); | |||
if (extfun->getName().str().compare(declName) == 0) | |||
if (extfun->getName().str().compare(LLVMUtil::processMangledName(declName)) == 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Promote this to outer loop
svf-llvm/lib/LLVMUtil.cpp
Outdated
// First, remove all characters that do not conform to the C language naming rules. | ||
std::string cleanedName = std::regex_replace(mangledName, std::regex("[^a-zA-Z0-9_]"), ""); | ||
// Then, if the result starts with a number, remove these numbers. | ||
cleanedName = std::regex_replace(cleanedName, std::regex("^\\d+"), ""); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to remove underline too.
No description provided.