1 //===-- clang-tools-extra/clang-tidy/NoLintDirectiveHandler.h ----*- C++ *-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_NOLINTDIRECTIVEHANDLER_H
10 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_NOLINTDIRECTIVEHANDLER_H
12 #include "clang/Basic/Diagnostic.h"
13 #include "llvm/ADT/StringRef.h"
19 } // namespace tooling
23 template <typename T
> class SmallVectorImpl
;
29 /// This class is used to locate NOLINT comments in the file being analyzed, to
30 /// decide whether a diagnostic should be suppressed.
31 /// This class keeps a cache of every NOLINT comment found so that files do not
32 /// have to be repeatedly parsed each time a new diagnostic is raised.
33 class NoLintDirectiveHandler
{
35 NoLintDirectiveHandler();
36 ~NoLintDirectiveHandler();
38 bool shouldSuppress(DiagnosticsEngine::Level DiagLevel
,
39 const Diagnostic
&Diag
, llvm::StringRef DiagName
,
40 llvm::SmallVectorImpl
<tooling::Diagnostic
> &NoLintErrors
,
41 bool AllowIO
, bool EnableNoLintBlocks
);
45 std::unique_ptr
<Impl
> PImpl
;
51 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_NOLINTDIRECTIVEHANDLER_H