This is an archive of the discontinued LLVM Phabricator instance.

[clang-tidy] altera-id-dependent-backward-branch: fix assignment notes
Needs ReviewPublic

Authored by yeputons-gh on Mar 5 2023, 10:06 AM.



Previously a note was always issued on a variable declaration itself. Now it points to the actual assignment of get_local_id to the variable, like with fields. Do the same for note messages about inferred id-dependencies. They previously pointed to the declaration of the original id-dependent variable, not the assignment from it.

There are six cases of assignment inferrence in the code, all are tested: a variable initialized from a variable/field, a variable assigned from a variable/field, a field assigned from a variable/field.

Depends on D145305

Diff Detail

Event Timeline

yeputons-gh created this revision.Mar 5 2023, 10:06 AM
Herald added a project: Restricted Project. · View Herald Transcript
yeputons-gh requested review of this revision.Mar 5 2023, 10:06 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 5 2023, 10:06 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript

Test inferred assignments and fix notes for them as well.

yeputons-gh retitled this revision from [clang-tidy] altera-id-dependent-backward-branch: fix direct assignment notes to [clang-tidy] altera-id-dependent-backward-branch: fix assignment notes.Mar 5 2023, 10:24 AM
yeputons-gh edited the summary of this revision. (Show Details)
yeputons-gh added inline comments.Mar 5 2023, 10:27 AM

This line was already correct prior to this patch.


It previously pointed at int ThreadIDAssigned = 0, not ThreadIDAssigned = get_local_id(0) * 2.


This became ThreadIDVarFromVar, see above.


I mirror all id-dependent tests with non-id-dependent to make sure does not creep back.