Skip to content

Fix: GetEnumConstantValue when value can't be within int64_t#970

Open
Vipul-Cariappa wants to merge 1 commit into
compiler-research:mainfrom
Vipul-Cariappa:dev/GetEnumConstantValue
Open

Fix: GetEnumConstantValue when value can't be within int64_t#970
Vipul-Cariappa wants to merge 1 commit into
compiler-research:mainfrom
Vipul-Cariappa:dev/GetEnumConstantValue

Conversation

@Vipul-Cariappa
Copy link
Copy Markdown
Collaborator

No description provided.

return INTEROP_RETURN(Val.getExtValue());
llvm::SmallString<40> StrVal;
Val.toString(StrVal);
return INTEROP_RETURN(std::stoul(StrVal.c_str()));
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need macro to check if sizeof(unsigned long) == sizeof(size_t) then call stoul, else if sizeof(unsigned long long) == sizeof(size_t), call stoull? For all the systems we are interested (64 bit), I believe sizeof(unsigned long) == sizeof(unsigned long long) == 64. Then we will also have to change the return type. What is the enum value is negative...!?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.81%. Comparing base (ca051ed) to head (bd7dde6).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #970      +/-   ##
==========================================
+ Coverage   81.79%   81.81%   +0.01%     
==========================================
  Files          15       15              
  Lines        4779     4783       +4     
==========================================
+ Hits         3909     3913       +4     
  Misses        870      870              
Files with missing lines Coverage Δ
lib/CppInterOp/CppInterOp.cpp 88.56% <100.00%> (+0.01%) ⬆️
Files with missing lines Coverage Δ
lib/CppInterOp/CppInterOp.cpp 88.56% <100.00%> (+0.01%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Contributor

@vgvassilev vgvassilev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

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