clang
22.0.0git
include
clang
StaticAnalyzer
Core
BugReporter
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
17
#include "
clang/Basic/SourceLocation.h
"
18
#include "llvm/ADT/DenseMap.h"
19
#include "llvm/ADT/SmallVector.h"
20
21
namespace
clang
{
22
class
ASTContext
;
23
class
Decl
;
24
25
namespace
ento
{
26
class
BugReport
;
27
class
PathDiagnosticLocation
;
28
29
class
BugSuppression
{
30
public
:
31
explicit
BugSuppression
(
const
ASTContext
&ACtx) : ACtx(ACtx) {}
32
33
using
DiagnosticIdentifierList
=
llvm::ArrayRef<llvm::StringRef>
;
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
44
private
:
45
// Overly pessimistic number, to be honest.
46
static
constexpr
unsigned
EXPECTED_NUMBER_OF_SUPPRESSIONS = 8;
47
using
CachedRanges =
48
llvm::SmallVector<SourceRange, EXPECTED_NUMBER_OF_SUPPRESSIONS>
;
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
SourceLocation.h
Defines the clang::SourceLocation class and associated facilities.
clang::ASTContext
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition
ASTContext.h:188
clang::Decl
Decl - This represents one declaration (or definition), e.g.
Definition
DeclBase.h:86
clang::ento::BugReport
This class provides an interface through which checkers can create individual bug reports.
Definition
BugReporter.h:119
clang::ento::BugSuppression::DiagnosticIdentifierList
llvm::ArrayRef< llvm::StringRef > DiagnosticIdentifierList
Definition
BugSuppression.h:33
clang::ento::BugSuppression::BugSuppression
BugSuppression(const ASTContext &ACtx)
Definition
BugSuppression.h:31
clang::ento::BugSuppression::isSuppressed
bool isSuppressed(const BugReport &)
Return true if the given bug report was explicitly suppressed by the user.
Definition
BugSuppression.cpp:154
clang::ento::PathDiagnosticLocation
Definition
PathDiagnostic.h:195
llvm::ArrayRef
Definition
LLVM.h:31
llvm::SmallVector
Definition
LLVM.h:35
clang::ento
Definition
CocoaConventions.h:23
clang
The JSON file list parser is used to communicate input to InstallAPI.
Definition
CalledOnceCheck.h:17
Generated on
for clang by
1.14.0