[clang-tools-extra] c883904 - Revert "Add a new altera kernel name restriction check to clang-tidy."

Nico Weber via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 2 07:31:31 PST 2020


Author: Nico Weber
Date: 2020-11-02T10:30:42-05:00
New Revision: c88390468cdd1de4283b2c5c7889f16c477791cd

URL: https://github.com/llvm/llvm-project/commit/c88390468cdd1de4283b2c5c7889f16c477791cd
DIFF: https://github.com/llvm/llvm-project/commit/c88390468cdd1de4283b2c5c7889f16c477791cd.diff

LOG: Revert "Add a new altera kernel name restriction check to clang-tidy."

This reverts commit 43a38a65233039b5e71797a644d41a890f8d7f2b,
and follow-up 5a7bc5e2595903e51f0b31e3faf82024e965c962.

The commit breaks check-clang-tools, the test added in the change
does not pass.

Added: 
    

Modified: 
    clang-tools-extra/clang-tidy/altera/AlteraTidyModule.cpp
    clang-tools-extra/clang-tidy/altera/CMakeLists.txt
    clang-tools-extra/docs/ReleaseNotes.rst
    clang-tools-extra/docs/clang-tidy/checks/list.rst

Removed: 
    clang-tools-extra/clang-tidy/altera/KernelNameRestrictionCheck.cpp
    clang-tools-extra/clang-tidy/altera/KernelNameRestrictionCheck.h
    clang-tools-extra/docs/clang-tidy/checks/altera-kernel-name-restriction.rst
    clang-tools-extra/test/clang-tidy/checkers/Inputs/altera-kernel-name-restriction/kernel.cl
    clang-tools-extra/test/clang-tidy/checkers/Inputs/altera-kernel-name-restriction/kernel.h
    clang-tools-extra/test/clang-tidy/checkers/Inputs/altera-kernel-name-restriction/other_Verilog.cl
    clang-tools-extra/test/clang-tidy/checkers/Inputs/altera-kernel-name-restriction/otherdir/vhdl.cl
    clang-tools-extra/test/clang-tidy/checkers/Inputs/altera-kernel-name-restriction/otherthing.cl
    clang-tools-extra/test/clang-tidy/checkers/Inputs/altera-kernel-name-restriction/some/dir/kernel.cl
    clang-tools-extra/test/clang-tidy/checkers/Inputs/altera-kernel-name-restriction/some/kernel.cl/foo.h
    clang-tools-extra/test/clang-tidy/checkers/Inputs/altera-kernel-name-restriction/some/verilog.cl/foo.h
    clang-tools-extra/test/clang-tidy/checkers/Inputs/altera-kernel-name-restriction/some/vhdl.cl/foo.h
    clang-tools-extra/test/clang-tidy/checkers/Inputs/altera-kernel-name-restriction/some_kernel.cl
    clang-tools-extra/test/clang-tidy/checkers/Inputs/altera-kernel-name-restriction/somedir/verilog.cl
    clang-tools-extra/test/clang-tidy/checkers/Inputs/altera-kernel-name-restriction/thing.h
    clang-tools-extra/test/clang-tidy/checkers/Inputs/altera-kernel-name-restriction/vERILOG.cl
    clang-tools-extra/test/clang-tidy/checkers/Inputs/altera-kernel-name-restriction/verilog.h
    clang-tools-extra/test/clang-tidy/checkers/Inputs/altera-kernel-name-restriction/vhdl.CL
    clang-tools-extra/test/clang-tidy/checkers/Inputs/altera-kernel-name-restriction/vhdl.h
    clang-tools-extra/test/clang-tidy/checkers/Inputs/altera-kernel-name-restriction/vhdl_number_two.cl
    clang-tools-extra/test/clang-tidy/checkers/altera-kernel-name-restriction.cpp


################################################################################
diff  --git a/clang-tools-extra/clang-tidy/altera/AlteraTidyModule.cpp b/clang-tools-extra/clang-tidy/altera/AlteraTidyModule.cpp
index d3e906b673ce..d91f67ac1485 100644
--- a/clang-tools-extra/clang-tidy/altera/AlteraTidyModule.cpp
+++ b/clang-tools-extra/clang-tidy/altera/AlteraTidyModule.cpp
@@ -9,7 +9,6 @@
 #include "../ClangTidy.h"
 #include "../ClangTidyModule.h"
 #include "../ClangTidyModuleRegistry.h"
-#include "KernelNameRestrictionCheck.h"
 #include "StructPackAlignCheck.h"
 
 using namespace clang::ast_matchers;
@@ -21,8 +20,6 @@ namespace altera {
 class AlteraModule : public ClangTidyModule {
 public:
   void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
-    CheckFactories.registerCheck<KernelNameRestrictionCheck>(
-        "altera-kernel-name-restriction");
     CheckFactories.registerCheck<StructPackAlignCheck>(
         "altera-struct-pack-align");
   }

diff  --git a/clang-tools-extra/clang-tidy/altera/CMakeLists.txt b/clang-tools-extra/clang-tidy/altera/CMakeLists.txt
index 8ab5cc1aa4ad..ed28d9f4892d 100644
--- a/clang-tools-extra/clang-tidy/altera/CMakeLists.txt
+++ b/clang-tools-extra/clang-tidy/altera/CMakeLists.txt
@@ -5,7 +5,6 @@ set(LLVM_LINK_COMPONENTS
 
 add_clang_library(clangTidyAlteraModule
   AlteraTidyModule.cpp
-  KernelNameRestrictionCheck.cpp
   StructPackAlignCheck.cpp
 
   LINK_LIBS

diff  --git a/clang-tools-extra/clang-tidy/altera/KernelNameRestrictionCheck.cpp b/clang-tools-extra/clang-tidy/altera/KernelNameRestrictionCheck.cpp
deleted file mode 100644
index eb49977cbedb..000000000000
--- a/clang-tools-extra/clang-tidy/altera/KernelNameRestrictionCheck.cpp
+++ /dev/null
@@ -1,107 +0,0 @@
-//===--- KernelNameRestrictionCheck.cpp - clang-tidy ----------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#include "KernelNameRestrictionCheck.h"
-#include "clang/Frontend/CompilerInstance.h"
-#include "clang/Lex/PPCallbacks.h"
-#include "clang/Lex/Preprocessor.h"
-#include <string>
-#include <vector>
-
-using namespace clang::ast_matchers;
-
-namespace clang {
-namespace tidy {
-namespace altera {
-
-namespace {
-
-class KernelNameRestrictionPPCallbacks : public PPCallbacks {
-public:
-  explicit KernelNameRestrictionPPCallbacks(ClangTidyCheck &Check,
-                                            const SourceManager &SM)
-      : Check(Check), SM(SM) {}
-
-  void InclusionDirective(SourceLocation HashLoc, const Token &IncludeTok,
-                          StringRef FileName, bool IsAngled,
-                          CharSourceRange FileNameRange, const FileEntry *File,
-                          StringRef SearchPath, StringRef RelativePath,
-                          const Module *Imported,
-                          SrcMgr::CharacteristicKind FileType) override;
-
-  void EndOfMainFile() override;
-
-private:
-  /// Returns true if the name of the file with path FilePath is 'kernel.cl',
-  /// 'verilog.cl', or 'vhdl.cl'. The file name check is case insensitive.
-  bool FileNameIsRestricted(StringRef FilePath);
-
-  struct IncludeDirective {
-    SourceLocation Loc; // Location in the include directive.
-    StringRef FileName; // Filename as a string.
-  };
-
-  std::vector<IncludeDirective> IncludeDirectives;
-  ClangTidyCheck &Check;
-  const SourceManager &SM;
-};
-
-} // namespace
-
-void KernelNameRestrictionCheck::registerPPCallbacks(const SourceManager &SM,
-                                                     Preprocessor *PP,
-                                                     Preprocessor *) {
-  PP->addPPCallbacks(
-      std::make_unique<KernelNameRestrictionPPCallbacks>(*this, SM));
-}
-
-void KernelNameRestrictionPPCallbacks::InclusionDirective(
-    SourceLocation HashLoc, const Token &, StringRef FileName, bool,
-    CharSourceRange, const FileEntry *, StringRef, StringRef, const Module *,
-    SrcMgr::CharacteristicKind) {
-  IncludeDirective ID = {HashLoc, FileName};
-  IncludeDirectives.push_back(std::move(ID));
-}
-
-bool KernelNameRestrictionPPCallbacks::FileNameIsRestricted(
-    StringRef FileName) {
-  return FileName.equals_lower("kernel.cl") ||
-         FileName.equals_lower("verilog.cl") ||
-         FileName.equals_lower("vhdl.cl");
-}
-
-void KernelNameRestrictionPPCallbacks::EndOfMainFile() {
-
-  // Check main file for restricted names.
-  const FileEntry *Entry = SM.getFileEntryForID(SM.getMainFileID());
-  StringRef FileName = llvm::sys::path::filename(Entry->getName());
-  if (FileNameIsRestricted(FileName))
-    Check.diag(SM.getLocForStartOfFile(SM.getMainFileID()),
-               "compiling '%0' may cause additional compilation errors due "
-               "to the name of the kernel source file; consider renaming the "
-               "included kernel source file")
-        << FileName;
-
-  if (IncludeDirectives.empty())
-    return;
-
-  // Check included files for restricted names.
-  for (const IncludeDirective &ID : IncludeDirectives) {
-    StringRef FileName = llvm::sys::path::filename(ID.FileName);
-    if (FileNameIsRestricted(FileName))
-      Check.diag(ID.Loc,
-                 "including '%0' may cause additional compilation errors due "
-                 "to the name of the kernel source file; consider renaming the "
-                 "included kernel source file")
-          << FileName;
-  }
-}
-
-} // namespace altera
-} // namespace tidy
-} // namespace clang

diff  --git a/clang-tools-extra/clang-tidy/altera/KernelNameRestrictionCheck.h b/clang-tools-extra/clang-tidy/altera/KernelNameRestrictionCheck.h
deleted file mode 100644
index cf91ca1fd4c0..000000000000
--- a/clang-tools-extra/clang-tidy/altera/KernelNameRestrictionCheck.h
+++ /dev/null
@@ -1,35 +0,0 @@
-//===--- KernelNameRestrictionCheck.h - clang-tidy --------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_ALTERA_KERNEL_NAME_RESTRICTION_CHECK_H
-#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_ALTERA_KERNEL_NAME_RESTRICTION_CHECK_H
-
-#include "../ClangTidyCheck.h"
-
-namespace clang {
-namespace tidy {
-namespace altera {
-
-/// Finds kernel files and include directives whose filename is `kernel.cl`,
-/// `Verilog.cl`, or `VHDL.cl`.
-///
-/// For the user-facing documentation see:
-/// http://clang.llvm.org/extra/clang-tidy/checks/altera-kernel-name-restriction.html
-class KernelNameRestrictionCheck : public ClangTidyCheck {
-public:
-  KernelNameRestrictionCheck(StringRef Name, ClangTidyContext *Context)
-      : ClangTidyCheck(Name, Context) {}
-  void registerPPCallbacks(const SourceManager &SM, Preprocessor *PP,
-                           Preprocessor *) override;
-};
-
-} // namespace altera
-} // namespace tidy
-} // namespace clang
-
-#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_ALTERA_KERNEL_NAME_RESTRICTION_CHECK_H

diff  --git a/clang-tools-extra/docs/ReleaseNotes.rst b/clang-tools-extra/docs/ReleaseNotes.rst
index d29c0730ed6d..9a182d534615 100644
--- a/clang-tools-extra/docs/ReleaseNotes.rst
+++ b/clang-tools-extra/docs/ReleaseNotes.rst
@@ -85,12 +85,6 @@ New modules
 New checks
 ^^^^^^^^^^
 
-- New :doc:`altera-kernel-name-restriction
-  <clang-tidy/checks/altera-kernel-name-restriction>` check.
-
-  Finds kernel files and include directives whose filename is `kernel.cl`,
-  `Verilog.cl`, or `VHDL.cl`.
-
 - New :doc:`altera-struct-pack-align
   <clang-tidy/checks/altera-struct-pack-align>` check.
 

diff  --git a/clang-tools-extra/docs/clang-tidy/checks/altera-kernel-name-restriction.rst b/clang-tools-extra/docs/clang-tidy/checks/altera-kernel-name-restriction.rst
deleted file mode 100644
index 86cc10bef957..000000000000
--- a/clang-tools-extra/docs/clang-tidy/checks/altera-kernel-name-restriction.rst
+++ /dev/null
@@ -1,15 +0,0 @@
-.. title:: clang-tidy - altera-kernel-name-restriction
-
-altera-kernel-name-restriction
-==============================
-
-Finds kernel files and include directives whose filename is `kernel.cl`,
-`Verilog.cl`, or `VHDL.cl`. The check is case insensitive.
-
-Such kernel file names cause the offline compiler to generate intermediate
-design files that have the same names as certain internal files, which
-leads to a compilation error.
-
-Based on the `Guidelines for Naming the Kernel` section in the
-`Intel FPGA SDK for OpenCL Pro Edition: Programming Guide
-<https://www.intel.com/content/www/us/en/programmable/documentation/mwh1391807965224.html#ewa1412973930963>`_.

diff  --git a/clang-tools-extra/docs/clang-tidy/checks/list.rst b/clang-tools-extra/docs/clang-tidy/checks/list.rst
index 5e2bb0c67ef2..ec0e200b91d1 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/list.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/list.rst
@@ -30,7 +30,6 @@ Clang-Tidy Checks
    `abseil-time-comparison <abseil-time-comparison.html>`_, "Yes"
    `abseil-time-subtraction <abseil-time-subtraction.html>`_, "Yes"
    `abseil-upgrade-duration-conversions <abseil-upgrade-duration-conversions.html>`_, "Yes"
-   `altera-kernel-name-restriction <altera-kernel-name-restriction.html>`_,
    `altera-struct-pack-align <altera-struct-pack-align.html>`_,
    `android-cloexec-accept <android-cloexec-accept.html>`_, "Yes"
    `android-cloexec-accept4 <android-cloexec-accept4.html>`_,

diff  --git a/clang-tools-extra/test/clang-tidy/checkers/Inputs/altera-kernel-name-restriction/kernel.cl b/clang-tools-extra/test/clang-tidy/checkers/Inputs/altera-kernel-name-restriction/kernel.cl
deleted file mode 100644
index cb6da8c213f8..000000000000
--- a/clang-tools-extra/test/clang-tidy/checkers/Inputs/altera-kernel-name-restriction/kernel.cl
+++ /dev/null
@@ -1 +0,0 @@
-const int KERNELINT = 1;

diff  --git a/clang-tools-extra/test/clang-tidy/checkers/Inputs/altera-kernel-name-restriction/kernel.h b/clang-tools-extra/test/clang-tidy/checkers/Inputs/altera-kernel-name-restriction/kernel.h
deleted file mode 100644
index 83a4de7f84e4..000000000000
--- a/clang-tools-extra/test/clang-tidy/checkers/Inputs/altera-kernel-name-restriction/kernel.h
+++ /dev/null
@@ -1 +0,0 @@
-const int KERNELINT3 = 1;

diff  --git a/clang-tools-extra/test/clang-tidy/checkers/Inputs/altera-kernel-name-restriction/other_Verilog.cl b/clang-tools-extra/test/clang-tidy/checkers/Inputs/altera-kernel-name-restriction/other_Verilog.cl
deleted file mode 100644
index 4ca87e32e7d5..000000000000
--- a/clang-tools-extra/test/clang-tidy/checkers/Inputs/altera-kernel-name-restriction/other_Verilog.cl
+++ /dev/null
@@ -1 +0,0 @@
-const int OTHERVERILOGINT = 2;

diff  --git a/clang-tools-extra/test/clang-tidy/checkers/Inputs/altera-kernel-name-restriction/otherdir/vhdl.cl b/clang-tools-extra/test/clang-tidy/checkers/Inputs/altera-kernel-name-restriction/otherdir/vhdl.cl
deleted file mode 100644
index 65d4eeb09ec3..000000000000
--- a/clang-tools-extra/test/clang-tidy/checkers/Inputs/altera-kernel-name-restriction/otherdir/vhdl.cl
+++ /dev/null
@@ -1 +0,0 @@
-const int OTHERDIRVHDLINT = 3;

diff  --git a/clang-tools-extra/test/clang-tidy/checkers/Inputs/altera-kernel-name-restriction/otherthing.cl b/clang-tools-extra/test/clang-tidy/checkers/Inputs/altera-kernel-name-restriction/otherthing.cl
deleted file mode 100644
index 1e26850d5c7d..000000000000
--- a/clang-tools-extra/test/clang-tidy/checkers/Inputs/altera-kernel-name-restriction/otherthing.cl
+++ /dev/null
@@ -1 +0,0 @@
-const int OTHERTHINGINT = 1;

diff  --git a/clang-tools-extra/test/clang-tidy/checkers/Inputs/altera-kernel-name-restriction/some/dir/kernel.cl b/clang-tools-extra/test/clang-tidy/checkers/Inputs/altera-kernel-name-restriction/some/dir/kernel.cl
deleted file mode 100644
index 9d259fe3303d..000000000000
--- a/clang-tools-extra/test/clang-tidy/checkers/Inputs/altera-kernel-name-restriction/some/dir/kernel.cl
+++ /dev/null
@@ -1 +0,0 @@
-const int SOMEDIRKERNELINT = 1;

diff  --git a/clang-tools-extra/test/clang-tidy/checkers/Inputs/altera-kernel-name-restriction/some/kernel.cl/foo.h b/clang-tools-extra/test/clang-tidy/checkers/Inputs/altera-kernel-name-restriction/some/kernel.cl/foo.h
deleted file mode 100644
index b8a781ea004b..000000000000
--- a/clang-tools-extra/test/clang-tidy/checkers/Inputs/altera-kernel-name-restriction/some/kernel.cl/foo.h
+++ /dev/null
@@ -1 +0,0 @@
-int SOME_KERNEL_FOO_INT = 0;

diff  --git a/clang-tools-extra/test/clang-tidy/checkers/Inputs/altera-kernel-name-restriction/some/verilog.cl/foo.h b/clang-tools-extra/test/clang-tidy/checkers/Inputs/altera-kernel-name-restriction/some/verilog.cl/foo.h
deleted file mode 100644
index edcfb8b43e9c..000000000000
--- a/clang-tools-extra/test/clang-tidy/checkers/Inputs/altera-kernel-name-restriction/some/verilog.cl/foo.h
+++ /dev/null
@@ -1 +0,0 @@
-int SOME_VERILOG_FOO_INT = 0;

diff  --git a/clang-tools-extra/test/clang-tidy/checkers/Inputs/altera-kernel-name-restriction/some/vhdl.cl/foo.h b/clang-tools-extra/test/clang-tidy/checkers/Inputs/altera-kernel-name-restriction/some/vhdl.cl/foo.h
deleted file mode 100644
index 94e738edd4ff..000000000000
--- a/clang-tools-extra/test/clang-tidy/checkers/Inputs/altera-kernel-name-restriction/some/vhdl.cl/foo.h
+++ /dev/null
@@ -1 +0,0 @@
-int SOME_VHDL_FOO_INT = 0;

diff  --git a/clang-tools-extra/test/clang-tidy/checkers/Inputs/altera-kernel-name-restriction/some_kernel.cl b/clang-tools-extra/test/clang-tidy/checkers/Inputs/altera-kernel-name-restriction/some_kernel.cl
deleted file mode 100644
index 76c4aa22103e..000000000000
--- a/clang-tools-extra/test/clang-tidy/checkers/Inputs/altera-kernel-name-restriction/some_kernel.cl
+++ /dev/null
@@ -1 +0,0 @@
-const int SOMEKERNELINT = 1;

diff  --git a/clang-tools-extra/test/clang-tidy/checkers/Inputs/altera-kernel-name-restriction/somedir/verilog.cl b/clang-tools-extra/test/clang-tidy/checkers/Inputs/altera-kernel-name-restriction/somedir/verilog.cl
deleted file mode 100644
index 0566afdf11ca..000000000000
--- a/clang-tools-extra/test/clang-tidy/checkers/Inputs/altera-kernel-name-restriction/somedir/verilog.cl
+++ /dev/null
@@ -1 +0,0 @@
-const int SOMEDIRVERILOGINT = 2;

diff  --git a/clang-tools-extra/test/clang-tidy/checkers/Inputs/altera-kernel-name-restriction/thing.h b/clang-tools-extra/test/clang-tidy/checkers/Inputs/altera-kernel-name-restriction/thing.h
deleted file mode 100644
index a5c40de98c8b..000000000000
--- a/clang-tools-extra/test/clang-tidy/checkers/Inputs/altera-kernel-name-restriction/thing.h
+++ /dev/null
@@ -1 +0,0 @@
-const int THINGINT = 1;

diff  --git a/clang-tools-extra/test/clang-tidy/checkers/Inputs/altera-kernel-name-restriction/vERILOG.cl b/clang-tools-extra/test/clang-tidy/checkers/Inputs/altera-kernel-name-restriction/vERILOG.cl
deleted file mode 100644
index eb9a947dc967..000000000000
--- a/clang-tools-extra/test/clang-tidy/checkers/Inputs/altera-kernel-name-restriction/vERILOG.cl
+++ /dev/null
@@ -1 +0,0 @@
-const int VERILOGINT2 = 2;

diff  --git a/clang-tools-extra/test/clang-tidy/checkers/Inputs/altera-kernel-name-restriction/verilog.h b/clang-tools-extra/test/clang-tidy/checkers/Inputs/altera-kernel-name-restriction/verilog.h
deleted file mode 100644
index 701e21a96dd6..000000000000
--- a/clang-tools-extra/test/clang-tidy/checkers/Inputs/altera-kernel-name-restriction/verilog.h
+++ /dev/null
@@ -1 +0,0 @@
-const int VERILOGINT3 = 2;

diff  --git a/clang-tools-extra/test/clang-tidy/checkers/Inputs/altera-kernel-name-restriction/vhdl.CL b/clang-tools-extra/test/clang-tidy/checkers/Inputs/altera-kernel-name-restriction/vhdl.CL
deleted file mode 100644
index 1585c7e86c7b..000000000000
--- a/clang-tools-extra/test/clang-tidy/checkers/Inputs/altera-kernel-name-restriction/vhdl.CL
+++ /dev/null
@@ -1 +0,0 @@
-const int VHDLINT2 = 3;

diff  --git a/clang-tools-extra/test/clang-tidy/checkers/Inputs/altera-kernel-name-restriction/vhdl.h b/clang-tools-extra/test/clang-tidy/checkers/Inputs/altera-kernel-name-restriction/vhdl.h
deleted file mode 100644
index 59d2001977b2..000000000000
--- a/clang-tools-extra/test/clang-tidy/checkers/Inputs/altera-kernel-name-restriction/vhdl.h
+++ /dev/null
@@ -1 +0,0 @@
-const int VHDLINT3 = 3;

diff  --git a/clang-tools-extra/test/clang-tidy/checkers/Inputs/altera-kernel-name-restriction/vhdl_number_two.cl b/clang-tools-extra/test/clang-tidy/checkers/Inputs/altera-kernel-name-restriction/vhdl_number_two.cl
deleted file mode 100644
index c196407d4b5f..000000000000
--- a/clang-tools-extra/test/clang-tidy/checkers/Inputs/altera-kernel-name-restriction/vhdl_number_two.cl
+++ /dev/null
@@ -1 +0,0 @@
-const int VHDLNUMBERTWOINT = 3;

diff  --git a/clang-tools-extra/test/clang-tidy/checkers/altera-kernel-name-restriction.cpp b/clang-tools-extra/test/clang-tidy/checkers/altera-kernel-name-restriction.cpp
deleted file mode 100644
index 2dbfb1236523..000000000000
--- a/clang-tools-extra/test/clang-tidy/checkers/altera-kernel-name-restriction.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-// RUN: %check_clang_tidy %s altera-kernel-name-restriction %t -- -- -I%S/Inputs/altera-kernel-name-restriction
-
-// These are the banned kernel filenames, and should trigger warnings
-#include "kernel.cl"
-// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: including 'kernel.cl' may cause additional compilation errors due to the name of the kernel source file; consider renaming the included kernel source file [altera-kernel-name-restriction]
-#include "Verilog.cl"
-// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: including 'Verilog.cl' may cause additional compilation errors due to the name of the kernel source file; consider renaming the included kernel source file [altera-kernel-name-restriction]
-#include "VHDL.cl"
-// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: including 'VHDL.cl' may cause additional compilation errors due to the name of the kernel source file; consider renaming the included kernel source file [altera-kernel-name-restriction]
-
-// The warning should be triggered regardless of capitalization
-#include "KERNEL.cl"
-// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: including 'KERNEL.cl' may cause additional compilation errors due to the name of the kernel source file; consider renaming the included kernel source file [altera-kernel-name-restriction]
-#include "vERILOG.cl"
-// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: including 'vERILOG.cl' may cause additional compilation errors due to the name of the kernel source file; consider renaming the included kernel source file [altera-kernel-name-restriction]
-#include "vhdl.CL"
-// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: including 'vhdl.CL' may cause additional compilation errors due to the name of the kernel source file; consider renaming the included kernel source file [altera-kernel-name-restriction]
-
-// The warning should be triggered if the names are within a directory
-#include "some/dir/kernel.cl"
-// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: including 'kernel.cl' may cause additional compilation errors due to the name of the kernel source file; consider renaming the included kernel source file [altera-kernel-name-restriction]
-#include "somedir/verilog.cl"
-// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: including 'verilog.cl' may cause additional compilation errors due to the name of the kernel source file; consider renaming the included kernel source file [altera-kernel-name-restriction]
-#include "otherdir/vhdl.cl"
-// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: including 'vhdl.cl' may cause additional compilation errors due to the name of the kernel source file; consider renaming the included kernel source file [altera-kernel-name-restriction]
-
-// There are no FIX-ITs for the altera-kernel-name-restriction lint check
-
-// The following include directives shouldn't trigger the warning
-#include "otherthing.cl"
-#include "thing.h"
-
-// It doesn't make sense to have kernel.h, verilog.h, or vhdl.h as filenames
-// without the corresponding .cl files, but the Altera Programming Guide doesn't
-// explicitly forbid it.
-#include "kernel.h"
-#include "verilog.h"
-#include "vhdl.h"
-
-// The files can still have the forbidden names in them, so long as they're not
-// the entire file name, and are not the kernel source file name.
-#include "some_kernel.cl"
-#include "other_Verilog.cl"
-#include "vhdl_number_two.cl"
-
-// Naming a directory kernel.cl, verilog.cl, or vhdl.cl is not explicitly
-// forbidden in the Altera Programming Guide either.
-#include "some/kernel.cl/foo.h"
-#include "some/verilog.cl/foo.h"
-#include "some/vhdl.cl/foo.h"


        


More information about the cfe-commits mailing list