Skip to content
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

Merged
merged 3 commits into from
Mar 6, 2024

Conversation

shuangxiangkan
Copy link
Contributor

No description provided.

Copy link

codecov bot commented Mar 5, 2024

Codecov Report

Attention: Patch coverage is 62.50000% with 6 lines in your changes are missing coverage. Please review.

Project coverage is 67.82%. Comparing base (9aa7d45) to head (fcef80c).
Report is 1 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@            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     
Files Coverage Δ
svf-llvm/include/SVF-LLVM/LLVMUtil.h 80.00% <ø> (ø)
svf-llvm/lib/LLVMModule.cpp 82.95% <100.00%> (+0.02%) ⬆️
svf-llvm/lib/LLVMUtil.cpp 77.86% <53.84%> (-0.89%) ⬇️

@@ -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)
Copy link
Collaborator

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

@@ -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)
Copy link
Collaborator

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

// 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+"), "");
Copy link
Collaborator

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.

@yuleisui yuleisui merged commit 0f01ec0 into SVF-tools:master Mar 6, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants