This is an archive of the discontinued LLVM Phabricator instance.

clang-tidy altera-id-dependent-backward-branch: print notes after warning
ClosedPublic

Authored by yeputons-gh on Mar 4 2023, 3:27 AM.

Details

Summary

In Clang notes are typically printed after a corresponding warning, not before.
For example, all notes issued before the first warning are ignored.

Running clang-tidy --checks=-*,altera-id-dependent-backward-branch a.cpp on the following code:

long get_local_id(int);
void error() {
  int ThreadID = get_local_id(0);
  for (int i = 0; i < ThreadID; i++) {
  }
  for (int i = 0; i < ThreadID; i++) {
  }
}

results in two warnings and a single note in between.

Diff Detail

Event Timeline

yeputons-gh created this revision.Mar 4 2023, 3:27 AM
Herald added a project: Restricted Project. · View Herald Transcript
yeputons-gh requested review of this revision.Mar 4 2023, 3:27 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 4 2023, 3:27 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
yeputons-gh edited the summary of this revision. (Show Details)Mar 4 2023, 4:07 PM
carlosgalvezp accepted this revision.Mar 5 2023, 7:34 AM
This revision is now accepted and ready to land.Mar 5 2023, 7:34 AM

Thanks for the fix! Can you land the patch or would need that we do it for you? If so please provide Github name and email for attribution.

Hi, @carlosgalvezp ! I don't have any commit rights for the LLVM project, so I probably need help. My GitHub handle is yeputons (https://github.com/yeputons/), my email for attribution is egor.suvorov@gmail.com (that's my first name, last name)