dexonsmith added a comment.

In D89834#2357910 <https://reviews.llvm.org/D89834#2357910>, @dexonsmith wrote:

> Dropped `MaybeFileEntryRef`, instead customizing `Optional<FileEntryRef>`.

As @arphaman pointed out offline, we can actually `OptionalStorage` instead, by 
adding add a private constructor to `FileEntryRef` that `nullptr`-initializes 
and only `OptionalStorage` calls.

The reason I think customizing `Optional` is better is the ability to add 
`operator const FileEntry *`. This avoids having to update large swaths of code 
like this in an incremental patch:

  // old code
  lvalue = rvalue;
  // new code
  auto F = rvalue;
  lvalue = F ? &F->getFileEntry() : nullptr;

just to revert it back in a later incremental patch once `FileEntryRef` has 
made it further.

This was one the primary reasons I originally added `MaybeFileEntryRef`.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D89834/new/

https://reviews.llvm.org/D89834

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
  • [PATCH] D89834: Fi... Duncan P. N. Exon Smith via Phabricator via cfe-commits
    • [PATCH] D8983... Duncan P. N. Exon Smith via Phabricator via cfe-commits

Reply via email to