You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Because clang frontend action and ppcallback does not rely on those getData() to access data structures. Those data structures are passed by reference into callbacks
So getData() mostly are accessed by clients. And those data structures should be determined and unchanged once frontend compilation finished.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
Currently clients can fully access
IncludeGraphData
byIncludeGraph::getData()
since it is returning a raw pointer.It is volatile and then becomes stateful, so that may be easily misused.
Describe the solution you'd like
We should instead make
IncludeGraph::getData()
return const pointer.So that
IncludeGraphData
can only be changed in frontend action and ppcallback, and becomes read-only toward clients.The component that needs to modify
IncludeGraphData
should make a copy of it and take care of the lifetime of the copy themselvesDescribe alternatives you've considered
Additional context
We should consider making all
getData()
returnconst
pointer like this: https://github.com/bloomberg/clangmetatool/blob/master/include/clangmetatool/collectors/find_functions.h#L63Because clang frontend action and ppcallback does not rely on those
getData()
to access data structures. Those data structures are passed by reference into callbacksSo
getData()
mostly are accessed by clients. And those data structures should be determined and unchanged once frontend compilation finished.The text was updated successfully, but these errors were encountered: