This is an archive of the discontinued LLVM Phabricator instance.

[clang][dataflow] Reverse course on `getValue()` deprecation.
ClosedPublic

Authored by mboehme on Jul 21 2023, 12:53 AM.

Details

Summary

In the value categories RFC, I proposed that the end state of the migration should be that getValue() should only be legal to call on prvalues.

As a stepping stone, to allow migrating off existing calls to getValue(), I proposed introducing getValueStrict(), which would already have the new semantics.

However, I've now reconsidered this. Any expression, whether prvalue or glvalue, has a value, so really there isn't any reason to forbid calling getValue() on glvalues. I'm therefore removing the deprecation from getValue() and transitioning existing getValueStrict() calls back to getValue().

The other "strict" accessors are a different case. setValueStrict() should only be called on prvalues because glvalues need to have a storage location associated with them; it doesn't make sense to only set a value for them. And, of course, getStorageLocationStrict() and setStorageLocationStrict() should obviously only be called on glvalues because prvalues don't have storage locations.

Diff Detail

Event Timeline

mboehme created this revision.Jul 21 2023, 12:53 AM
Herald added a project: Restricted Project. · View Herald Transcript
mboehme requested review of this revision.Jul 21 2023, 12:53 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 21 2023, 12:53 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
mboehme edited the summary of this revision. (Show Details)Jul 21 2023, 12:57 AM
ymandel accepted this revision.Jul 21 2023, 5:35 AM

This sounds reasonable to me.

This revision is now accepted and ready to land.Jul 21 2023, 5:35 AM
xazax.hun accepted this revision.EditedJul 21 2023, 4:29 PM

Sounds good to me. I believe this will make check author's lives easier.

mboehme updated this revision to Diff 544335.Jul 26 2023, 6:17 AM

Rebase to head

mboehme updated this revision to Diff 544337.Jul 26 2023, 6:18 AM

Rebase to head

Pre-merge failure looks unrelated. It's in AST/Interp/literals.cpp, and this patch shouldn't affect that in any way.

This revision was landed with ongoing or failed builds.Jul 27 2023, 6:15 AM
This revision was automatically updated to reflect the committed changes.