-
-
Notifications
You must be signed in to change notification settings - Fork 21.7k
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
Make a header for VariantUtilityFunctions #78108
Conversation
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.
LGTM.
To be clear, we would still be including the cpp file in the codebase (like |
@YuriSizov I think it's fine if we don't have inlining in the test cases, right? |
Yes, I'm talking about other parts of the engine that include variant utils directly, such as the aforementioned class. |
fcd2fb7
to
7e9b5e5
Compare
@YuriSizov You are correct, I did not see that before (EDIT: well, that's because it was added only recently #64628). Note that we must remove the inline keyword for this to compile (unless we want to move the full definitions into the header). However the compiler may inline these methods anyway when compiling |
I think losing the EditorResourcePreview should definitely not include a Edit: EditorResourcePreview seems to include VariantUtilityFunctions for |
I would get @reduz to check to be honest, I can't say I'm familiar with the template-fu that goes on in The suggestion seems correct that using the header from |
For some context, I want to include the utility functions in another place: unit tests. If the unit tests include the |
This is something that we wanted to do with @vnen so many of those are available to the VM to use as inlined opcodes, so thumbs up on that and PR may be good anyway. That said, if you want to do unit tests, I think its not a good idea to access them yourself directly. Simply call |
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.
reduz's comments sound like an approval of the header change, so let's go with this.
Thanks! |
The motivation behind this PR is to allow writing unit tests for VariantUtilityFunctions. Without this PR, the only way to write a test would be to include the
.cpp
file, but this would result in linker warnings about duplicate symbols.Aside from tests, this also allows using the utility functions from anywhere in the C++ code, like in a custom module.