[PATCH] D138658: [DebugInfo] Store optional DIFile::Source as pointer

Scott Linder via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 2 14:02:24 PST 2022


scott.linder added a comment.

In D138658#3965822 <https://reviews.llvm.org/D138658#3965822>, @Hahnfeld wrote:

>> I think we can't use `getCanonicalMDString` here, because it collapses the empty case into the null case, when they were intended to be differentiated. So this'll need to be manually expanded to the `MDString::get(Context, S)` without the empty->nullptr part. Then empty -> empty MDString, None -> null, non-empty -> non-empty MDString.
>
> Ok, I understood @scott.linder's comment to say that we can collapse the two cases. Maybe I got this wrong, could you clarify if we need to differentiate the two cases? If so, I'm not actually sure it makes sense to have a non-`nullptr` for the empty string, this would be a first as well, all other cases in this file are using `getCanonicalMDString`...

Sorry for the confusion! I think we should retain the distinction, I only meant to say I'm OK with a different representation. That is, I am OK with using a `nullptr` to signal "No Source Available", as distinct from the empty string.


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

https://reviews.llvm.org/D138658



More information about the llvm-commits mailing list