The new deleted constructor overload makes sure that no implicit
conversion from 0 would happen to ArrayRef<const char*>.
Also adds nodiscard to the CallDescriptionMap::lookup()
Differential D113588
[analyzer][NFC] Make the API of CallDescription safer slightly steakhal on Nov 10 2021, 10:45 AM. Authored by
Details
The new deleted constructor overload makes sure that no implicit Also adds nodiscard to the CallDescriptionMap::lookup()
Diff Detail Event TimelineComment Actions
Did you encounter a call with a nullptr? Comment Actions Are there other classes in LLVM taking a single ArrayRef in the constructor? Are they using similar techniques to avoid potential problems? Comment Actions I did not. But it makes sense to delete: https://quuxplusone.github.io/blog/2021/10/17/equals-delete-means/ I don't know.
They should. Comment Actions I guess this constructor prevents us from to just put this into ArrayRef: /// Construct an ArrayRef from a single element. /*implicit*/ ArrayRef(const T &OneElt) : Data(&OneElt), Length(1) {} I guess this is a "why not" patch, so, LGTM! Comment Actions I've accidentally committed this without mentioning the Differential Revision stuff in the commit message. :( How to address this? Comment Actions There is no way, as we do not have rights to force push the official upstream master. Otherwise, whatever. The commit is in, that's it. |