Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:36:23

0001 //===-- clang-tools-extra/clang-tidy/NoLintDirectiveHandler.h ----*- C++ *-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_NOLINTDIRECTIVEHANDLER_H
0010 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_NOLINTDIRECTIVEHANDLER_H
0011 
0012 #include "clang/Basic/Diagnostic.h"
0013 #include "llvm/ADT/StringRef.h"
0014 #include <memory>
0015 
0016 namespace clang::tooling {
0017 struct Diagnostic;
0018 } // namespace clang::tooling
0019 
0020 namespace llvm {
0021 template <typename T> class SmallVectorImpl;
0022 } // namespace llvm
0023 
0024 namespace clang::tidy {
0025 
0026 /// This class is used to locate NOLINT comments in the file being analyzed, to
0027 /// decide whether a diagnostic should be suppressed.
0028 /// This class keeps a cache of every NOLINT comment found so that files do not
0029 /// have to be repeatedly parsed each time a new diagnostic is raised.
0030 class NoLintDirectiveHandler {
0031 public:
0032   NoLintDirectiveHandler();
0033   ~NoLintDirectiveHandler();
0034   NoLintDirectiveHandler(const NoLintDirectiveHandler &) = delete;
0035   NoLintDirectiveHandler &operator=(const NoLintDirectiveHandler &) = delete;
0036 
0037   bool shouldSuppress(DiagnosticsEngine::Level DiagLevel,
0038                       const Diagnostic &Diag, llvm::StringRef DiagName,
0039                       llvm::SmallVectorImpl<tooling::Diagnostic> &NoLintErrors,
0040                       bool AllowIO, bool EnableNoLintBlocks);
0041 
0042 private:
0043   class Impl;
0044   std::unique_ptr<Impl> PImpl;
0045 };
0046 
0047 } // namespace clang::tidy
0048 
0049 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_NOLINTDIRECTIVEHANDLER_H