class BasicBugReport

Declaration

class BasicBugReport : public BugReport { /* full declaration omitted */ };

Description

This class provides an interface through which checkers can create individual bug reports.

Declared at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h:251

Inherits from: BugReport

Member Variables

private clang::ento::PathDiagnosticLocation Location
private const clang::Decl* DeclWithIssue = nullptr

Inherited from BugReport:

protected K
protected BT
protected ShortDescription
protected Description
protected Ranges
protected Notes
protected Fixits

Method Overview

Inherited from BugReport:

Methods

BasicBugReport(
    const clang::ento::BugType& bt,
    llvm::StringRef desc,
    clang::ento::PathDiagnosticLocation l)

Declared at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h:256

Parameters

const clang::ento::BugType& bt
llvm::StringRef desc
clang::ento::PathDiagnosticLocation l

void Profile(llvm::FoldingSetNodeID& hash) const

Description

Reports are uniqued to ensure that we do not emit multiple diagnostics for each bug.

Declared at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h:286

Parameters

llvm::FoldingSetNodeID& hash

static bool classof(
    const clang::ento::BugReport* R)

Declared at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h:259

Parameters

const clang::ento::BugReport* R

const clang::Decl* getDeclWithIssue() const

Description

The smallest declaration that contains the bug location. This is purely cosmetic; the declaration can be displayed to the user but it does not affect whether the report is emitted.

Declared at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h:268

clang::ento::PathDiagnosticLocation getLocation()
    const

Description

The primary location of the bug report that points at the undesirable behavior in the code. UIs should attach the warning description to this location. The warning description should describe the bad behavior at this location.

Declared at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h:263

const clang::Decl* getUniqueingDecl() const

Description

Get the declaration that corresponds to (usually contains) the uniqueing location. This is not actively used for uniqueing, i.e. otherwise identical reports that have different uniqueing decls will be considered equivalent.

Declared at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h:276

clang::ento::PathDiagnosticLocation
getUniqueingLocation() const

Description

Get the location on which the report should be uniqued. Two warnings are considered to be equivalent whenever they have the same bug types, descriptions, and uniqueing locations. Out of a class of equivalent warnings only one gets displayed to the user. For most warnings the uniqueing location coincides with their location, but sometimes it makes sense to use different locations. For example, a leak checker can place the warning at the location where the last reference to the leaking resource is dropped but at the same time unique the warning by where that resource is acquired (allocated).

Declared at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h:272

void setDeclWithIssue(
    const clang::Decl* declWithIssue)

Description

Specifically set the Decl where an issue occurred. This isn't necessary for BugReports that cover a path as it will be automatically inferred.

Declared at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h:282

Parameters

const clang::Decl* declWithIssue