This is an archive of the discontinued LLVM Phabricator instance.

[clang][Parse] Remove constant expression from if condition
ClosedPublic

Authored by tbaeder on Nov 18 2022, 5:17 AM.

Details

Reviewers
None
Group Reviewers
Restricted Project
Commits
rG2a1c192bd6bf: [clang][Parse] Remove constant expression from if condition
Summary

MaybeTypeCast here is not a variable, it's an enum member with value 1.

I'm just not sure if this should be using isTypeCast instead or not. Let's see what the CI says.

Diff Detail

Event Timeline

tbaeder created this revision.Nov 18 2022, 5:17 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 18 2022, 5:17 AM
tbaeder requested review of this revision.Nov 18 2022, 5:17 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 18 2022, 5:17 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript

This code was introduced in https://github.com/llvm/llvm-project/commit/5a5319062300166a747807339349766341a2c2b2 and does not appear to have had precommit review (that I could find). It was resolving https://bugs.llvm.org/show_bug.cgi?id=23101, and the last comment on that issue suggests this was intending to look at isTypeCast.

I expect precommit CI will not care about the removal because it is a no-op change.

tbaeder updated this revision to Diff 476452.Nov 18 2022, 6:28 AM

Precommit CI found that this change breaks clang/test/Sema/PR28181.c which was introduced to fix https://bugs.llvm.org/show_bug.cgi?id=28181 which was a regression caused by https://github.com/llvm/llvm-project/commit/5a5319062300166a747807339349766341a2c2b2

Yeah, just removing the MaybeTypeCast worked, but switching to isTypeCast doens't.

Yeah, just removing the MaybeTypeCast worked, but switching to isTypeCast doens't.

I think for now we can remove the MaybeTypeCast entirely. We only set isTypeCast once we *know* we're dealing with a type cast, and this is about typo correction where we probably don't know what we're dealing with. Given that it's a no-op change to do that, removing it leaves us in no worse shape than we were before.

This revision was not accepted when it landed; it landed in state Needs Review.Nov 22 2022, 8:31 AM
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.