clang 19.0.0git
BugSuppression.h
Go to the documentation of this file.
1//===- BugSuppression.h - Suppression interface -----------------*- C++ -*-===//
2//
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
6//
7//===----------------------------------------------------------------------===//
8//
9// This file defines BugSuppression, a simple interface class encapsulating
10// all user provided in-code suppressions.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_CLANG_STATICANALYZER_CORE_BUGREPORTER_SUPPRESSION_H
15#define LLVM_CLANG_STATICANALYZER_CORE_BUGREPORTER_SUPPRESSION_H
16
18#include "llvm/ADT/DenseMap.h"
19#include "llvm/ADT/SmallVector.h"
20
21namespace clang {
22class ASTContext;
23class Decl;
24
25namespace ento {
26class BugReport;
27class PathDiagnosticLocation;
28
30public:
31 explicit BugSuppression(const ASTContext &ACtx) : ACtx(ACtx) {}
32
34
35 /// Return true if the given bug report was explicitly suppressed by the user.
36 bool isSuppressed(const BugReport &);
37
38 /// Return true if the bug reported at the given location was explicitly
39 /// suppressed by the user.
40 bool isSuppressed(const PathDiagnosticLocation &Location,
41 const Decl *DeclWithIssue,
42 DiagnosticIdentifierList DiagnosticIdentification);
43
44private:
45 // Overly pessimistic number, to be honest.
46 static constexpr unsigned EXPECTED_NUMBER_OF_SUPPRESSIONS = 8;
47 using CachedRanges =
49
50 llvm::DenseMap<const Decl *, CachedRanges> CachedSuppressionLocations;
51
52 const ASTContext &ACtx;
53};
54
55} // end namespace ento
56} // end namespace clang
57
58#endif // LLVM_CLANG_STATICANALYZER_CORE_BUGREPORTER_SUPPRESSION_H
Defines the clang::SourceLocation class and associated facilities.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:182
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:86
This class provides an interface through which checkers can create individual bug reports.
Definition: BugReporter.h:119
BugSuppression(const ASTContext &ACtx)
bool isSuppressed(const BugReport &)
Return true if the given bug report was explicitly suppressed by the user.
@ Decl
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
The JSON file list parser is used to communicate input to InstallAPI.