clang  12.0.0git
Public Types | Public Member Functions | Public Attributes | List of all members
clang::tooling::Diagnostic Struct Reference

Represents the diagnostic with the level of severity and possible fixes to be applied. More...

#include "clang/Tooling/Core/Diagnostic.h"

Collaboration diagram for clang::tooling::Diagnostic:
Collaboration graph
[legend]

Public Types

enum  Level { Warning = DiagnosticsEngine::Warning, Error = DiagnosticsEngine::Error }
 

Public Member Functions

 Diagnostic ()=default
 
 Diagnostic (llvm::StringRef DiagnosticName, Level DiagLevel, StringRef BuildDirectory)
 
 Diagnostic (llvm::StringRef DiagnosticName, const DiagnosticMessage &Message, const SmallVector< DiagnosticMessage, 1 > &Notes, Level DiagLevel, llvm::StringRef BuildDirectory, const SmallVector< FileByteRange, 1 > &Ranges)
 

Public Attributes

std::string DiagnosticName
 Name identifying the Diagnostic. More...
 
DiagnosticMessage Message
 Message associated to the diagnostic. More...
 
SmallVector< DiagnosticMessage, 1 > Notes
 Potential notes about the diagnostic. More...
 
Level DiagLevel
 Diagnostic level. Can indicate either an error or a warning. More...
 
std::string BuildDirectory
 A build directory of the diagnostic source file. More...
 
SmallVector< FileByteRange, 1 > Ranges
 Extra source ranges associated with the diagnostic (in addition to the location of the Message above). More...
 

Detailed Description

Represents the diagnostic with the level of severity and possible fixes to be applied.

Definition at line 63 of file Diagnostic.h.

Member Enumeration Documentation

◆ Level

Enumerator
Warning 
Error 

Definition at line 64 of file Diagnostic.h.

Constructor & Destructor Documentation

◆ Diagnostic() [1/3]

clang::tooling::Diagnostic::Diagnostic ( )
default

◆ Diagnostic() [2/3]

clang::tooling::Diagnostic::Diagnostic ( llvm::StringRef  DiagnosticName,
Diagnostic::Level  DiagLevel,
StringRef  BuildDirectory 
)

Definition at line 48 of file Diagnostic.cpp.

◆ Diagnostic() [3/3]

clang::tooling::Diagnostic::Diagnostic ( llvm::StringRef  DiagnosticName,
const DiagnosticMessage Message,
const SmallVector< DiagnosticMessage, 1 > &  Notes,
Level  DiagLevel,
llvm::StringRef  BuildDirectory,
const SmallVector< FileByteRange, 1 > &  Ranges 
)

Definition at line 53 of file Diagnostic.cpp.

Member Data Documentation

◆ BuildDirectory

std::string clang::tooling::Diagnostic::BuildDirectory

A build directory of the diagnostic source file.

It's an absolute path which is directory field of the source file in compilation database. If users don't specify the compilation database directory, it is the current directory where clang-tidy runs.

Note: it is empty in unittest.

Definition at line 98 of file Diagnostic.h.

◆ DiagLevel

Level clang::tooling::Diagnostic::DiagLevel

Diagnostic level. Can indicate either an error or a warning.

Definition at line 89 of file Diagnostic.h.

◆ DiagnosticName

std::string clang::tooling::Diagnostic::DiagnosticName

Name identifying the Diagnostic.

Definition at line 80 of file Diagnostic.h.

◆ Message

DiagnosticMessage clang::tooling::Diagnostic::Message

Message associated to the diagnostic.

Definition at line 83 of file Diagnostic.h.

Referenced by clang::tooling::selectFirstFix().

◆ Notes

SmallVector<DiagnosticMessage, 1> clang::tooling::Diagnostic::Notes

Potential notes about the diagnostic.

Definition at line 86 of file Diagnostic.h.

Referenced by clang::tooling::selectFirstFix().

◆ Ranges

SmallVector<FileByteRange, 1> clang::tooling::Diagnostic::Ranges

Extra source ranges associated with the diagnostic (in addition to the location of the Message above).

Definition at line 102 of file Diagnostic.h.


The documentation for this struct was generated from the following files: