Skip to content

Refactor: helper function functionTypeToString()#5889

Merged
firewave merged 3 commits intocppcheck-opensource:mainfrom
chrchr-github:chr_funcType
Jan 17, 2024
Merged

Refactor: helper function functionTypeToString()#5889
firewave merged 3 commits intocppcheck-opensource:mainfrom
chrchr-github:chr_funcType

Conversation

@chrchr-github
Copy link
Copy Markdown
Collaborator

No description provided.

Comment thread lib/symboldatabase.cpp Outdated
std::cout << std::endl;
}

static std::string functionTypeToString(Function::Type type)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Returning const char* would preserve the previous behavior and would also avoid generate an temporary std::string (not sure if inlining would get rid of that).

Copy link
Copy Markdown
Collaborator Author

@chrchr-github chrchr-github Jan 17, 2024

Choose a reason for hiding this comment

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

Thing is, there are similar helper functions (scopeTypeToString, accessControlToString) which return std::string. Adjusted and grouped together.

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.

I also see use of std::endl and std::ostringstream, which probably doesn't help performance either. Or it might just be irrelevant.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thing is, there are similar helper functions (scopeTypeToString, accessControlToString) which return std::string. Adjusted and grouped together.

It shouldn't really matter much. Just mentioned it because it changed the behavior.

I also see use of std::endl and std::ostringstream, which probably doesn't help performance either. Or it might just be irrelevant.

The most relevant places have already been adjusted. I am not going into profiling again until my other big tasks are finally done and I filed some more upstream tickets about suboptimal code generation.

@firewave firewave merged commit 9889837 into cppcheck-opensource:main Jan 17, 2024
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