Page MenuHomePhabricator

[clang-tidy] new altera ID dependent backward branch check
Needs ReviewPublic

Authored by ffrankies on Nov 11 2019, 10:36 AM.

Details

Summary

This lint check is a part of the FLOCL (FPGA Linters for OpenCL) project out of the Synergy Lab at Virginia Tech.

FLOCL is a set of lint checks aimed at FPGA developers who write code in OpenCL.

The altera ID dependent backward branch lint check finds ID dependent variables and fields used within loops, and warns of their usage. Using these variables in loops can lead to performance degradation.

Diff Detail

Event Timeline

ffrankies created this revision.Nov 11 2019, 10:36 AM
jdoerfert resigned from this revision.Nov 11 2019, 11:55 AM
Eugene.Zelenko added inline comments.
clang-tidy/altera/IdDependentBackwardBranchCheck.cpp
107

Please don't use auto when type is not explicitly spelled in same statement or iterator.

130

Please don't use auto when type is not explicitly spelled in same statement or iterator.

mgehre removed a subscriber: mgehre.Nov 11 2019, 10:55 PM

Implemented changes requested by @Eugene.Zelenko

Also changed for loop in hasIdDepVar and hasIdDepField to range-based for loops, and updated the license information in IdDependentBackwardBranchCheck.cpp

clang-tidy/altera/IdDependentBackwardBranchCheck.cpp
116

May be comments were shifted with code, but here const auto * could be used, because type is spelled in dyn_cast<>.

117

May be comments were shifted with code, but here const auto * could be used, because type is spelled in dyn_cast<>.

125

May be comments were shifted with code, but here const auto * could be used, because type is iterator.

126

May be comments were shifted with code, but here const auto * could be used, because type is spelled in dyn_cast<>.

166

const auto *. Same in other dyn_cast<>.

ffrankies updated this revision to Diff 232724.Sat, Dec 7, 8:13 PM
ffrankies marked 2 inline comments as done.

Addressed @Eugene.Zelenko's comments on use of auto