clang 20.0.0git
Classes | Public Types | Public Member Functions | List of all members
clang::ast_matchers::dynamic::Diagnostics Class Reference

Helper class to manage error messages. More...

#include "clang/ASTMatchers/Dynamic/Diagnostics.h"

Classes

class  ArgStream
 Helper stream class. More...
 
struct  Context
 Class defining a parser context. More...
 
struct  ContextFrame
 Information stored for one frame of the context. More...
 
struct  ErrorContent
 Information stored for each error found. More...
 
struct  OverloadContext
 Context for overloaded matcher construction. More...
 

Public Types

enum  ContextType { CT_MatcherArg = 0 , CT_MatcherConstruct = 1 }
 Parser context types. More...
 
enum  ErrorType {
  ET_None = 0 , ET_RegistryMatcherNotFound = 1 , ET_RegistryWrongArgCount = 2 , ET_RegistryWrongArgType = 3 ,
  ET_RegistryNotBindable = 4 , ET_RegistryAmbiguousOverload = 5 , ET_RegistryValueNotFound = 6 , ET_RegistryUnknownEnumWithReplace = 7 ,
  ET_RegistryNonNodeMatcher = 8 , ET_RegistryMatcherNoWithSupport = 9 , ET_ParserStringError = 100 , ET_ParserNoOpenParen = 101 ,
  ET_ParserNoCloseParen = 102 , ET_ParserNoComma = 103 , ET_ParserNoCode = 104 , ET_ParserNotAMatcher = 105 ,
  ET_ParserInvalidToken = 106 , ET_ParserMalformedBindExpr = 107 , ET_ParserTrailingCode = 108 , ET_ParserNumberError = 109 ,
  ET_ParserOverloadedType = 110 , ET_ParserMalformedChainedExpr = 111 , ET_ParserFailedToBuildMatcher = 112
}
 All errors from the system. More...
 

Public Member Functions

ArgStream addError (SourceRange Range, ErrorType Error)
 Add an error to the diagnostics.
 
ArrayRef< ErrorContenterrors () const
 
void printToStream (llvm::raw_ostream &OS) const
 Returns a simple string representation of each error.
 
std::string toString () const
 
void printToStreamFull (llvm::raw_ostream &OS) const
 Returns the full string representation of each error.
 
std::string toStringFull () const
 

Detailed Description

Helper class to manage error messages.

Definition at line 50 of file Diagnostics.h.

Member Enumeration Documentation

◆ ContextType

Parser context types.

Enumerator
CT_MatcherArg 
CT_MatcherConstruct 

Definition at line 53 of file Diagnostics.h.

◆ ErrorType

All errors from the system.

Enumerator
ET_None 
ET_RegistryMatcherNotFound 
ET_RegistryWrongArgCount 
ET_RegistryWrongArgType 
ET_RegistryNotBindable 
ET_RegistryAmbiguousOverload 
ET_RegistryValueNotFound 
ET_RegistryUnknownEnumWithReplace 
ET_RegistryNonNodeMatcher 
ET_RegistryMatcherNoWithSupport 
ET_ParserStringError 
ET_ParserNoOpenParen 
ET_ParserNoCloseParen 
ET_ParserNoComma 
ET_ParserNoCode 
ET_ParserNotAMatcher 
ET_ParserInvalidToken 
ET_ParserMalformedBindExpr 
ET_ParserTrailingCode 
ET_ParserNumberError 
ET_ParserOverloadedType 
ET_ParserMalformedChainedExpr 
ET_ParserFailedToBuildMatcher 

Definition at line 59 of file Diagnostics.h.

Member Function Documentation

◆ addError()

Diagnostics::ArgStream clang::ast_matchers::dynamic::Diagnostics::addError ( SourceRange  Range,
ErrorType  Error 
)

Add an error to the diagnostics.

All the context information will be kept on the error message.

Returns
a helper class to allow the caller to pass the arguments for the error message, using the << operator.

Definition at line 65 of file Diagnostics.cpp.

References clang::Last, and Range.

◆ errors()

ArrayRef< ErrorContent > clang::ast_matchers::dynamic::Diagnostics::errors ( ) const
inline

Definition at line 163 of file Diagnostics.h.

◆ printToStream()

void clang::ast_matchers::dynamic::Diagnostics::printToStream ( llvm::raw_ostream &  OS) const

Returns a simple string representation of each error.

Each error only shows the error message without any context.

Definition at line 196 of file Diagnostics.cpp.

References clang::ast_matchers::dynamic::printErrorContentToStream().

Referenced by toString().

◆ printToStreamFull()

void clang::ast_matchers::dynamic::Diagnostics::printToStreamFull ( llvm::raw_ostream &  OS) const

Returns the full string representation of each error.

Each error message contains the full context.

Definition at line 210 of file Diagnostics.cpp.

References clang::ast_matchers::dynamic::printContextFrameToStream(), and clang::ast_matchers::dynamic::printErrorContentToStream().

Referenced by toStringFull().

◆ toString()

std::string clang::ast_matchers::dynamic::Diagnostics::toString ( ) const

Definition at line 203 of file Diagnostics.cpp.

References printToStream().

◆ toStringFull()

std::string clang::ast_matchers::dynamic::Diagnostics::toStringFull ( ) const

Definition at line 222 of file Diagnostics.cpp.

References printToStreamFull().


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