This is an archive of the discontinued LLVM Phabricator instance.

In clang-tidy base checks prevent anonymous functions from triggering assertions
ClosedPublic

Authored by bogser01 on Aug 4 2020, 9:37 AM.

Details

Summary

Skeleton checks generated by clang-tidy add_check.py cause assertions to fail when run over anonymous functions(lambda functions). This patch introduces an additional check to verify that the target function is not anonymous before calling getName().
The code snippet from the [[ https://clang.llvm.org/extra/clang-tidy/Contributing.html | clang-tidy tutorial ]]is also updated.

Diff Detail

Event Timeline

bogser01 created this revision.Aug 4 2020, 9:37 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 4 2020, 9:37 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
bogser01 requested review of this revision.Aug 4 2020, 9:37 AM
DavidTruby accepted this revision.Aug 10 2020, 6:39 AM
DavidTruby added a reviewer: DavidTruby.

LGTM - please wait for someone more familiar with clang-tidy to review as well

This revision is now accepted and ready to land.Aug 10 2020, 6:40 AM
alexfh accepted this revision.Aug 10 2020, 8:45 AM

LG with a couple of comments. Do you need someone to land the patch for you?

clang-tools-extra/clang-tidy/add_new_check.py
139

No need for parentheses around this.

clang-tools-extra/docs/clang-tidy/Contributing.rst
206

ditto.