This is an archive of the discontinued LLVM Phabricator instance.

[CUDA] Ignore uncallable functions when we check for usual deallocators.
ClosedPublic

Authored by tra on Sep 7 2018, 11:46 AM.

Details

Summary

Previously clang considered function variants from both sides of
compilation and that sometimes resulted in picking up wrong deallocation function.

Event Timeline

tra created this revision.Sep 7 2018, 11:46 AM
rsmith added inline comments.Sep 14 2018, 4:18 PM
clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp
551 ↗(On Diff #164480)

I believe the isOverloadedOperator check here is redundant. The caller already checked that the name is an identifier.

If you want to keep some check of this kind, I'd suggest checking D->getIdentifier() at the start of this function and removing the check here. (Note that CXXMethodDecl is not the only Decl subclass that can have a non-identifier name.)

clang/lib/AST/DeclCXX.cpp
2067–2077

I think it would make more sense to put only the 1-parameter functions into Matches, and rename it to PreventedBy or something: then it's the list of single-parameter usual deallocation functions that prevent this one being a usual deallocation function.

tra updated this revision to Diff 165794.Sep 17 2018, 11:22 AM

Addressed Richard's comments.
Moved clang-tidy changes into separate review D52179.

tra updated this revision to Diff 166050.Sep 18 2018, 5:02 PM
tra marked an inline comment as done.

Updated assertion message.

tra updated this revision to Diff 166053.Sep 18 2018, 5:19 PM

Renamed last instance of 'Matches' -> 'PreventedBy'.

rsmith accepted this revision.Sep 21 2018, 10:05 AM
This revision is now accepted and ready to land.Sep 21 2018, 10:05 AM
This revision was automatically updated to reflect the committed changes.