[PATCH] D72218: [clang-tidy] new altera kernel name restriction check

Eugene Zelenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Jan 4 22:10:14 PST 2020


Eugene.Zelenko added inline comments.


================
Comment at: clang-tidy/altera/KernelNameRestrictionCheck.cpp:13
+#include "clang/Lex/Preprocessor.h"
+
+using namespace clang::ast_matchers;
----------------
Please include string, vector


================
Comment at: clang-tidy/altera/KernelNameRestrictionCheck.cpp:69
+  for (IncludeDirective &ID : IncludeDirectives) {
+    auto FilePath = StringRef(ID.Filename);
+    auto FileName = FilePath.substr(FilePath.find_last_of("/\\") + 1);
----------------
Please don't use auto unless type is not spelled in same statement or iterator.


================
Comment at: clang-tidy/altera/KernelNameRestrictionCheck.cpp:70
+    auto FilePath = StringRef(ID.Filename);
+    auto FileName = FilePath.substr(FilePath.find_last_of("/\\") + 1);
+    if (FileName.equals_lower("kernel.cl") ||
----------------
Please don't use auto unless type is not spelled in same statement or iterator.


================
Comment at: clang-tidy/altera/KernelNameRestrictionCheck.cpp:82
+  // Check main file for restricted names.
+  auto Entry = SM.getFileEntryForID(SM.getMainFileID());
+  StringRef FilePath = Entry->getName();
----------------
Please don't use auto unless type is not spelled in same statement or iterator.


================
Comment at: clang-tidy/altera/KernelNameRestrictionCheck.cpp:84
+  StringRef FilePath = Entry->getName();
+  auto FileName = FilePath.substr(FilePath.find_last_of("/\\") + 1);
+  if (FileName.equals_lower("kernel.cl") ||
----------------
Please don't use auto unless type is not spelled in same statement or iterator.


Repository:
  rCTE Clang Tools Extra

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

https://reviews.llvm.org/D72218





More information about the cfe-commits mailing list