[clang] [libclang] Replace createRef with createDup (PR #126683)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 25 16:03:19 PST 2025
erichkeane wrote:
> > Requesting changes just to be sure none of the changes from `createRef()` to `createDup()` would have generated a `StringRef` holding a null pointer. I'd be surprised if they did, but a second set of eyes would be helpful.
>
> I am not sure how to proceed here. This change was requested by @efriedma-quic on #125020
>
> I see 3 options:
>
> 1. Land as-is, but then we would not differentiate `createNull()` vs `createEmpty()` vs `createDup()`. No idea if this difference is important.
>
> 2. Move checks into `createDup()`, but then `createDup()` is not always a "Dup". Also no idead if this is important.
>
> 3. Just abandon the patch.
>
>
> WDYT?
Aaron is away this week, but: I believe he was asking for an analysis of all of the uses to make sure they don't use a null-StringRef anywhere.
IMO, an assert of some sort in the createDup interface would be sufficient to long-term prevent the problem.
https://github.com/llvm/llvm-project/pull/126683
More information about the cfe-commits
mailing list