MLIR  20.0.0git
Public Types | Public Member Functions | Friends | List of all members
mlir::DiagnosticArgument Class Reference

A variant type that holds a single argument for a diagnostic. More...

#include "mlir/IR/Diagnostics.h"

Public Types

enum class  DiagnosticArgumentKind {
  Attribute , Double , Integer , String ,
  Type , Unsigned
}
 Enum that represents the different kinds of diagnostic arguments supported. More...
 

Public Member Functions

 DiagnosticArgument (Attribute attr)
 Note: The constructors below are only exposed due to problems accessing constructors from type traits, they should not be used directly by users. More...
 
 DiagnosticArgument (double val)
 
 DiagnosticArgument (float val)
 
template<typename T >
 DiagnosticArgument (T val, std::enable_if_t< std::is_signed< T >::value &&std::numeric_limits< T >::is_integer &&sizeof(T)<=sizeof(int64_t)> *=nullptr)
 
template<typename T >
 DiagnosticArgument (T val, std::enable_if_t< std::is_unsigned< T >::value &&std::numeric_limits< T >::is_integer &&sizeof(T)<=sizeof(uint64_t)> *=nullptr)
 
 DiagnosticArgument (StringRef val)
 
 DiagnosticArgument (Type val)
 Construct from a Type. More...
 
void print (raw_ostream &os) const
 Outputs this argument to a stream. More...
 
DiagnosticArgumentKind getKind () const
 Returns the kind of this argument. More...
 
Attribute getAsAttribute () const
 Returns this argument as an Attribute. More...
 
double getAsDouble () const
 Returns this argument as a double. More...
 
int64_t getAsInteger () const
 Returns this argument as a signed integer. More...
 
StringRef getAsString () const
 Returns this argument as a string. More...
 
Type getAsType () const
 Returns this argument as a Type. More...
 
uint64_t getAsUnsigned () const
 Returns this argument as an unsigned integer. More...
 

Friends

class Diagnostic
 

Detailed Description

A variant type that holds a single argument for a diagnostic.

Definition at line 52 of file Diagnostics.h.

Member Enumeration Documentation

◆ DiagnosticArgumentKind

Enum that represents the different kinds of diagnostic arguments supported.

Enumerator
Attribute 
Double 
Integer 
String 
Type 
Unsigned 

Definition at line 84 of file Diagnostics.h.

Constructor & Destructor Documentation

◆ DiagnosticArgument() [1/7]

DiagnosticArgument::DiagnosticArgument ( Attribute  attr)
explicit

Note: The constructors below are only exposed due to problems accessing constructors from type traits, they should not be used directly by users.

Construct from an Attribute.

Definition at line 35 of file Diagnostics.cpp.

◆ DiagnosticArgument() [2/7]

mlir::DiagnosticArgument::DiagnosticArgument ( double  val)
inlineexplicit

Definition at line 59 of file Diagnostics.h.

◆ DiagnosticArgument() [3/7]

mlir::DiagnosticArgument::DiagnosticArgument ( float  val)
inlineexplicit

Definition at line 61 of file Diagnostics.h.

◆ DiagnosticArgument() [4/7]

template<typename T >
mlir::DiagnosticArgument::DiagnosticArgument ( val)
inlineexplicit

Definition at line 64 of file Diagnostics.h.

◆ DiagnosticArgument() [5/7]

template<typename T >
mlir::DiagnosticArgument::DiagnosticArgument ( val)
inlineexplicit

Definition at line 71 of file Diagnostics.h.

◆ DiagnosticArgument() [6/7]

mlir::DiagnosticArgument::DiagnosticArgument ( StringRef  val)
inlineexplicit

Definition at line 77 of file Diagnostics.h.

References mlir::String.

◆ DiagnosticArgument() [7/7]

DiagnosticArgument::DiagnosticArgument ( Type  val)
explicit

Construct from a Type.

Definition at line 40 of file Diagnostics.cpp.

Member Function Documentation

◆ getAsAttribute()

Attribute DiagnosticArgument::getAsAttribute ( ) const

Returns this argument as an Attribute.

Definition at line 45 of file Diagnostics.cpp.

References Attribute, mlir::Attribute::getFromOpaquePointer(), getKind(), and opaqueVal.

Referenced by print().

◆ getAsDouble()

double mlir::DiagnosticArgument::getAsDouble ( ) const
inline

Returns this argument as a double.

Definition at line 103 of file Diagnostics.h.

References Double, doubleVal, and getKind().

Referenced by print().

◆ getAsInteger()

int64_t mlir::DiagnosticArgument::getAsInteger ( ) const
inline

Returns this argument as a signed integer.

Definition at line 109 of file Diagnostics.h.

References getKind(), Integer, and opaqueVal.

Referenced by print().

◆ getAsString()

StringRef mlir::DiagnosticArgument::getAsString ( ) const
inline

Returns this argument as a string.

Definition at line 115 of file Diagnostics.h.

References getKind(), String, and stringVal.

Referenced by print().

◆ getAsType()

Type DiagnosticArgument::getAsType ( ) const

Returns this argument as a Type.

Definition at line 52 of file Diagnostics.cpp.

References mlir::Type::getFromOpaquePointer(), getKind(), opaqueVal, and Type.

Referenced by print().

◆ getAsUnsigned()

uint64_t mlir::DiagnosticArgument::getAsUnsigned ( ) const
inline

Returns this argument as an unsigned integer.

Definition at line 124 of file Diagnostics.h.

References getKind(), opaqueVal, and Unsigned.

Referenced by print().

◆ getKind()

DiagnosticArgumentKind mlir::DiagnosticArgument::getKind ( ) const
inline

Returns the kind of this argument.

Definition at line 97 of file Diagnostics.h.

Referenced by getAsAttribute(), getAsDouble(), getAsInteger(), getAsString(), getAsType(), and getAsUnsigned().

◆ print()

void DiagnosticArgument::print ( raw_ostream &  os) const

Outputs this argument to a stream.

Definition at line 58 of file Diagnostics.cpp.

References Attribute, Double, getAsAttribute(), getAsDouble(), getAsInteger(), getAsString(), getAsType(), getAsUnsigned(), Integer, String, Type, and Unsigned.

Referenced by mlir::operator<<().

Friends And Related Function Documentation

◆ Diagnostic

friend class Diagnostic
friend

Definition at line 130 of file Diagnostics.h.

Member Data Documentation

◆ doubleVal

double mlir::DiagnosticArgument::doubleVal

Definition at line 137 of file Diagnostics.h.

Referenced by getAsDouble().

◆ opaqueVal

intptr_t mlir::DiagnosticArgument::opaqueVal

Definition at line 138 of file Diagnostics.h.

Referenced by getAsAttribute(), getAsInteger(), getAsType(), and getAsUnsigned().

◆ stringVal

StringRef mlir::DiagnosticArgument::stringVal

Definition at line 139 of file Diagnostics.h.

Referenced by getAsString().


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