15#ifndef LLVM_CLANG_BASIC_PARTIALDIAGNOSTIC_H
16#define LLVM_CLANG_BASIC_PARTIALDIAGNOSTIC_H
21#include "llvm/ADT/SmallVector.h"
22#include "llvm/ADT/StringRef.h"
38 mutable unsigned DiagID = 0;
52 if (
Other.DiagStorage) {
68 typename = std::enable_if_t<!std::is_lvalue_reference<T>::value>>
78 Other.DiagStorage =
nullptr;
83 : DiagID(
Other.DiagID) {
86 if (
Other.DiagStorage)
91 : DiagID(
Other.getID()) {
94 for (
unsigned I = 0, N =
Other.getNumArgs(); I != N; ++I) {
102 for (
unsigned I = 0, N =
Other.getNumRanges(); I != N; ++I)
106 for (
unsigned I = 0, N =
Other.getNumFixItHints(); I != N; ++I)
111 DiagID =
Other.DiagID;
112 if (
Other.DiagStorage) {
127 DiagID =
Other.DiagID;
131 Other.DiagStorage =
nullptr;
136 std::swap(DiagID, PD.DiagID);
178 this->DiagID = DiagID;
187 assert(I < DiagStorage->NumDiagArgs &&
"Not enough diagnostic args");
Defines the Diagnostic-related interfaces.
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Defines the clang::SourceLocation class and associated facilities.
Represents a character-granular source range.
An allocator for DiagnosticStorage objects, which uses a small cache to objects, used to reduce mallo...
A little helper class used to produce diagnostics.
void Clear() const
Clear out the current diagnostic.
A little helper class (which is basically a smart pointer that forwards info from DiagnosticsEngine a...
void FormatDiagnostic(SmallVectorImpl< char > &OutStr) const
Format this diagnostic into a string, substituting the formal arguments into the %0 slots.
Concrete class used by the front-end to report problems and issues.
DiagnosticBuilder Report(SourceLocation Loc, unsigned DiagID)
Issue the message to the client.
@ ak_std_string
std::string
Annotates a diagnostic with some code that should be inserted, removed, or replaced to fix the proble...
void EmitToString(DiagnosticsEngine &Diags, SmallVectorImpl< char > &Buf) const
unsigned getDiagID() const
PartialDiagnostic(const PartialDiagnostic &Other, DiagnosticStorage *DiagStorage_)
PartialDiagnostic(const PartialDiagnostic &Other)
const PartialDiagnostic & operator<<(T &&V) const
PartialDiagnostic(const Diagnostic &Other, DiagStorageAllocator &Allocator_)
StringRef getStringArg(unsigned I)
Retrieve the string argument at the given index.
void Emit(const DiagnosticBuilder &DB) const
void setDiagID(unsigned ID)
PartialDiagnostic(unsigned DiagID, DiagStorageAllocator &Allocator_)
PartialDiagnostic & operator=(const PartialDiagnostic &Other)
const PartialDiagnostic & operator<<(const T &V) const
void Reset(unsigned DiagID=0)
Clear out this partial diagnostic, giving it a new diagnostic ID and removing all of its arguments,...
PartialDiagnostic & operator=(PartialDiagnostic &&Other)
void swap(PartialDiagnostic &PD)
PartialDiagnostic(NullDiagnostic)
Create a null partial diagnostic, which cannot carry a payload, and only exists to be swapped with a ...
PartialDiagnostic(PartialDiagnostic &&Other)
The streaming interface shared between DiagnosticBuilder and PartialDiagnostic.
DiagStorageAllocator * Allocator
Allocator used to allocate storage for this diagnostic.
DiagnosticStorage * DiagStorage
void AddString(StringRef V) const
void AddTaggedVal(uint64_t V, DiagnosticsEngine::ArgumentKind Kind) const
void AddSourceRange(const CharSourceRange &R) const
DiagnosticStorage * getStorage() const
Retrieve storage for this particular diagnostic.
void AddFixItHint(const FixItHint &Hint) const
The JSON file list parser is used to communicate input to InstallAPI.
const StreamingDiagnostic & operator<<(const StreamingDiagnostic &DB, const ASTContext::SectionInfo &Section)
Insertion operator for diagnostics.
const FunctionProtoType * T
std::pair< SourceLocation, PartialDiagnostic > PartialDiagnosticAt
A partial diagnostic along with the source location where this diagnostic occurs.
@ Other
Other implicit parameter.
__UINTPTR_TYPE__ uintptr_t
An unsigned integer type with the property that any valid pointer to void can be converted to this ty...
unsigned char DiagArgumentsKind[MaxArguments]
Specifies for each argument whether it is in DiagArgumentsStr or in DiagArguments.
SmallVector< CharSourceRange, 8 > DiagRanges
The list of ranges added to this diagnostic.
unsigned char NumDiagArgs
The number of entries in Arguments.
SmallVector< FixItHint, 6 > FixItHints
If valid, provides a hint with some code to insert, remove, or modify at a particular position.
std::string DiagArgumentsStr[MaxArguments]
The values for the various substitution positions that have string arguments.
uint64_t DiagArgumentsVal[MaxArguments]
The values for the various substitution positions.