This is an archive of the discontinued LLVM Phabricator instance.

[Sema][NFC] Create Sema::BuildImplicitCast
Needs ReviewPublic

Authored by fcloutier on Feb 5 2021, 8:19 PM.

Details

Summary

This change creates Sema::BuildImplicitCast, which the rest of Sema now uses to create implicit casts. The main change in terms of interface is that now, technically, creating an implicit cast could fail. However, the current implementation of BuildImplicitCast never does because it simply calls ImplicitCastExpr::Create.

Nevertheless, Sema users of ImplicitCastExpr::Create, and their downstream users in several cases, were updated to allow failing, except in some cases (such as in OpenMP) where existing code already didn't bother to check implicit casts failing.

rdar://74050758

Diff Detail

Event Timeline

fcloutier created this revision.Feb 5 2021, 8:19 PM
fcloutier requested review of this revision.Feb 5 2021, 8:19 PM
Herald added a project: Restricted Project. · View Herald Transcript
fcloutier edited the summary of this revision. (Show Details)Feb 5 2021, 8:28 PM
shafik added inline comments.Feb 8 2021, 6:29 PM
clang/lib/Sema/SemaCast.cpp
1060

Can we ever have this case w/ the added if (SrcExpr.isInvalid()) above

jkorous resigned from this revision.Jan 21 2022, 3:49 PM