[PATCH] D70094: [clang-tidy] new altera ID dependent backward branch check

Eugene Zelenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 27 12:47:08 PST 2019


Eugene.Zelenko added inline comments.


================
Comment at: clang-tidy/altera/IdDependentBackwardBranchCheck.cpp:115
+IdDependentBackwardBranchCheck::hasIdDepField(const Expr *Expression) {
+  if (const MemberExpr *MemberExpression = dyn_cast<MemberExpr>(Expression)) {
+    const FieldDecl *CheckField =
----------------
May be comments were shifted with code, but here const auto * could be used, because type is spelled in dyn_cast<>.


================
Comment at: clang-tidy/altera/IdDependentBackwardBranchCheck.cpp:116
+  if (const MemberExpr *MemberExpression = dyn_cast<MemberExpr>(Expression)) {
+    const FieldDecl *CheckField =
+        dyn_cast<FieldDecl>(MemberExpression->getMemberDecl());
----------------
May be comments were shifted with code, but here const auto * could be used, because type is spelled in dyn_cast<>.


================
Comment at: clang-tidy/altera/IdDependentBackwardBranchCheck.cpp:124
+  }
+  for (const Stmt *Child : Expression->children()) {
+    if (const Expr *ChildExpression = dyn_cast<Expr>(Child)) {
----------------
May be comments were shifted with code, but here const auto * could be used, because type is iterator.


================
Comment at: clang-tidy/altera/IdDependentBackwardBranchCheck.cpp:125
+  for (const Stmt *Child : Expression->children()) {
+    if (const Expr *ChildExpression = dyn_cast<Expr>(Child)) {
+      IdDependencyRecord *Result = hasIdDepField(ChildExpression);
----------------
May be comments were shifted with code, but here const auto * could be used, because type is spelled in dyn_cast<>.


================
Comment at: clang-tidy/altera/IdDependentBackwardBranchCheck.cpp:165
+  if (RefExpr) {
+    const auto RefVar = dyn_cast<VarDecl>(RefExpr->getDecl());
+    // If variable isn't ID-dependent, but RefVar is.
----------------
const auto *. Same in other dyn_cast<>.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70094/new/

https://reviews.llvm.org/D70094





More information about the cfe-commits mailing list