This is an archive of the discontinued LLVM Phabricator instance.

[ClangTidy] Fix false positives of readability-non-const-parameters check
Needs ReviewPublic

Authored by JacquesLucke on Jul 15 2020, 5:07 AM.

Details

Reviewers
alexfh
Summary

We recently started using Clang Tidy on the Blender source. We found a
couple of false positives of the readability-non-const-parameters check.
One of those is fixed by this patch.

struct MyStruct {
  float *values;
};

void myfunc(float *values) {
  MyStruct mystruct = {values};
}

Without this patch, Clang Tidy reports that the values parameter of
myfunc can be const. It does not recognize that it is assigned to
a non-const data member of MyStruct.

Note, this is the first time I'm working with the LLVM source code.
So please let me know if I'm doing something wrong.

Diff Detail

Event Timeline

JacquesLucke created this revision.Jul 15 2020, 5:07 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 15 2020, 5:07 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript

For some reason arc did not upload all the changes. Maybe because I cloned from github, will check. Anyway, here is the patch.