This is an archive of the discontinued LLVM Phabricator instance.

[DebugInfoMetadata] return early on nullptr arg
Needs ReviewPublic

Authored by nickdesaulniers on May 21 2019, 8:21 PM.

Details

Reviewers
echristo
Summary

This was flagged in https://www.viva64.com/en/b/0629/ under "Snippet No.
40".

It seems there's a nullptr check, but then Expr is later dereferenced
outside of the check. Since we can return an llvm::Optional, assume the
caller can handle llvm::None.

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptMay 21 2019, 8:21 PM

Any chance of a test case for this? (if you replace the null check with an assert for non-null, that might help identify a test case that hits this code?