Documentation for microsoft::quantum::ILogger
microsoft::quantum::ILogger
#include <Logging/ILogger.hpp>
Inherited by microsoft::quantum::CommentLogger, microsoft::quantum::LogCollection
Public Classes
Name | |
---|---|
struct | Location Class that holds the location of where the incident happened. |
struct | Message Struct to hold a message together with its type and location. |
Public Types
Name | |
---|---|
enum class | Type { Debug, Info, Warning, Error, InternalError} Enum description what type of information we are conveying. |
using llvm::Value | Value |
using std::function< SourceLocation(Value const *)> | LocationResolver |
using std::function< SourceLocation(String const &)> | LocationFromNameResolver |
using std::shared_ptr< ILogger > | ILoggerPtr |
using std::vector< Message > | Messages List of messages defined as alias. |
Public Functions
Name | |
---|---|
ILogger() =default | |
ILogger(ILogger const & ) | |
ILogger(ILogger && ) | |
ILogger & | operator=(ILogger const & ) |
ILogger & | operator=(ILogger && ) |
virtual | ~ILogger() |
virtual void | debug(String const & message) =0 Reports a debug message. |
virtual void | info(String const & message) =0 Reports an info message. |
virtual void | warning(String const & message) =0 Reports a warning message. |
virtual void | error(String const & message) =0 Reports an error message. |
virtual void | internalError(String const & message) =0 Reports an internal error message. |
virtual void | setLocation(SourceLocation const & location) =0 |
virtual void | setLlvmHint(String const & value) =0 Sets the value of the LLVM instruction causing the issue. |
virtual void | setFrontendHint(String const & value) =0 Sets the value of the frontend instruction causing the issue. |
virtual Messages const & | messages() const |
virtual void | dump(std::ostream & out) const |
void | setLocationFromValue(llvm::Value const * value) Sets the logger position based on a LLVM value. |
void | setLocationFromFunctionName(String const & name) Sets the logger position based on function name. |
void | setLocationResolver(LocationResolver const & r) Sets a resolver which that translates a LLVM value into a position in the source. |
void | setLocationFromNameResolver(LocationFromNameResolver const & r) Sets a resolver which that translates function name into a position in the source. |
SourceLocation | resolveLocation(llvm::Value const * value) Returns a source location from the value pointer (if possible) |
bool | hadErrors() const Whether or not errors were logged. |
bool | hadWarnings() const Whether or not warnings were logged. |
void | errorWithLocation(String const & message, llvm::Value * ptr =nullptr) |
void | warningWithLocation(String const & message, llvm::Value * ptr =nullptr) |
virtual void | errorCouldNotDeleteNode(llvm::Value * ptr =nullptr) Standard messages. |
virtual void | errorExpectedStraightLineCodeMultipleFunctions(llvm::Value * ptr =nullptr) |
virtual void | errorExpectedStraightLineCodeMultipleBlocks(llvm::Value * ptr =nullptr) |
virtual void | errorReleaseFailNonStandardAlloc(llvm::Value * ptr =nullptr) |
virtual void | warningReleasePhiNodeQubit(llvm::Value * ptr =nullptr) |
virtual void | errorFunctionInliningMaxRecursion(uint64_t n, llvm::Value * ptr =nullptr) |
virtual void | errorNoQubitsPresent(llvm::Value * ptr =nullptr, String const & name ="unnamed") |
virtual void | errorNoResultsPresent(llvm::Value * ptr =nullptr, String const & name ="unnamed") |
virtual void | errorOpcodeNotAllowed(String const & code, String const & target_name, llvm::Value * ptr =nullptr) |
virtual void | errorCustomFunctionsNotAllowed(llvm::Value * ptr =nullptr) |
virtual void | errorExternalCallsNotAllowed(String const & function_name, String const & target_name, llvm::Value * ptr =nullptr) |
virtual void | errorTypeNotAllowed(String const & type_name, String const & target_name, llvm::Value * ptr =nullptr) |
virtual void | errorPoisonNotAllowed(String const & target_name, llvm::Value * ptr =nullptr) |
virtual void | errorUndefNotAllowed(String const & target_name, llvm::Value * ptr =nullptr) |
virtual void | errorExpectedStringValueForAttr(String const & function_name, String const & attr_name) |
virtual void | warningWeakLinkReplacementNotPossible(String const & function_name, String const & replacement) |
virtual void | errorReplacementSignatureMismatch(String const & function_name, String const & signature1, String const & signature2) |
Protected Functions
Name | |
---|---|
void | setHasErrors(bool value) |
void | setHasWarnings(bool value) |
Detailed Description
class microsoft::quantum::ILogger;
Logger interface to allow the collection of different types of messages during QIR transformation and/or validation.
Public Types Documentation
enum Type
Enumerator | Value | Description |
---|---|---|
Debug | ||
Info | ||
Warning | ||
Error | ||
InternalError |
Enum description what type of information we are conveying.
using Value
using microsoft::quantum::ILogger::Value = llvm::Value;
using LocationResolver
using microsoft::quantum::ILogger::LocationResolver = std::function<SourceLocation(Value const*)>;
using LocationFromNameResolver
using microsoft::quantum::ILogger::LocationFromNameResolver = std::function<SourceLocation(String const&)>;
using ILoggerPtr
using microsoft::quantum::ILogger::ILoggerPtr = std::shared_ptr<ILogger>;
using Messages
using microsoft::quantum::ILogger::Messages = std::vector<Message>;
List of messages defined as alias.
Public Functions Documentation
function ILogger
ILogger() =default
function ILogger
ILogger(
ILogger const &
)
function ILogger
ILogger(
ILogger &&
)
function operator=
ILogger & operator=(
ILogger const &
)
function operator=
ILogger & operator=(
ILogger &&
)
function ~ILogger
virtual ~ILogger()
function debug
virtual void debug(
String const & message
) =0
Reports a debug message.
Reimplemented by: microsoft::quantum::CommentLogger::debug, microsoft::quantum::LogCollection::debug
function info
virtual void info(
String const & message
) =0
Reports an info message.
Reimplemented by: microsoft::quantum::CommentLogger::info, microsoft::quantum::LogCollection::info
function warning
virtual void warning(
String const & message
) =0
Reports a warning message.
Reimplemented by: microsoft::quantum::CommentLogger::warning, microsoft::quantum::LogCollection::warning
function error
virtual void error(
String const & message
) =0
Reports an error message.
Reimplemented by: microsoft::quantum::CommentLogger::error, microsoft::quantum::LogCollection::error
function internalError
virtual void internalError(
String const & message
) =0
Reports an internal error message.
Reimplemented by: microsoft::quantum::CommentLogger::internalError, microsoft::quantum::LogCollection::internalError
function setLocation
virtual void setLocation(
SourceLocation const & location
) =0
Reimplemented by: microsoft::quantum::CommentLogger::setLocation, microsoft::quantum::LogCollection::setLocation
Sets the current location. Importantly, the location can be set independently of the reported messages. This allows one to update the location upon updating the cursor position without having to worry about keeping a copy of the location to pass when reporting messages. The most obvious case of this is file path (name) with a line and character (line, col).
function setLlvmHint
virtual void setLlvmHint(
String const & value
) =0
Sets the value of the LLVM instruction causing the issue.
Reimplemented by: microsoft::quantum::CommentLogger::setLlvmHint, microsoft::quantum::LogCollection::setLlvmHint
function setFrontendHint
virtual void setFrontendHint(
String const & value
) =0
Sets the value of the frontend instruction causing the issue.
Reimplemented by: microsoft::quantum::CommentLogger::setFrontendHint, microsoft::quantum::LogCollection::setFrontendHint
function messages
virtual Messages const & messages() const
Reimplemented by: microsoft::quantum::LogCollection::messages
function dump
virtual void dump(
std::ostream & out
) const
Reimplemented by: microsoft::quantum::LogCollection::dump
function setLocationFromValue
void setLocationFromValue(
llvm::Value const * value
)
Sets the logger position based on a LLVM value.
function setLocationFromFunctionName
void setLocationFromFunctionName(
String const & name
)
Sets the logger position based on function name.
function setLocationResolver
void setLocationResolver(
LocationResolver const & r
)
Sets a resolver which that translates a LLVM value into a position in the source.
function setLocationFromNameResolver
void setLocationFromNameResolver(
LocationFromNameResolver const & r
)
Sets a resolver which that translates function name into a position in the source.
function resolveLocation
SourceLocation resolveLocation(
llvm::Value const * value
)
Returns a source location from the value pointer (if possible)
function hadErrors
bool hadErrors() const
Whether or not errors were logged.
function hadWarnings
bool hadWarnings() const
Whether or not warnings were logged.
function errorWithLocation
void errorWithLocation(
String const & message,
llvm::Value * ptr =nullptr
)
function warningWithLocation
void warningWithLocation(
String const & message,
llvm::Value * ptr =nullptr
)
function errorCouldNotDeleteNode
virtual void errorCouldNotDeleteNode(
llvm::Value * ptr =nullptr
)
Standard messages.
function errorExpectedStraightLineCodeMultipleFunctions
virtual void errorExpectedStraightLineCodeMultipleFunctions(
llvm::Value * ptr =nullptr
)
function errorExpectedStraightLineCodeMultipleBlocks
virtual void errorExpectedStraightLineCodeMultipleBlocks(
llvm::Value * ptr =nullptr
)
function errorReleaseFailNonStandardAlloc
virtual void errorReleaseFailNonStandardAlloc(
llvm::Value * ptr =nullptr
)
function warningReleasePhiNodeQubit
virtual void warningReleasePhiNodeQubit(
llvm::Value * ptr =nullptr
)
function errorFunctionInliningMaxRecursion
virtual void errorFunctionInliningMaxRecursion(
uint64_t n,
llvm::Value * ptr =nullptr
)
function errorNoQubitsPresent
virtual void errorNoQubitsPresent(
llvm::Value * ptr =nullptr,
String const & name ="unnamed"
)
function errorNoResultsPresent
virtual void errorNoResultsPresent(
llvm::Value * ptr =nullptr,
String const & name ="unnamed"
)
function errorOpcodeNotAllowed
virtual void errorOpcodeNotAllowed(
String const & code,
String const & target_name,
llvm::Value * ptr =nullptr
)
function errorCustomFunctionsNotAllowed
virtual void errorCustomFunctionsNotAllowed(
llvm::Value * ptr =nullptr
)
function errorExternalCallsNotAllowed
virtual void errorExternalCallsNotAllowed(
String const & function_name,
String const & target_name,
llvm::Value * ptr =nullptr
)
function errorTypeNotAllowed
virtual void errorTypeNotAllowed(
String const & type_name,
String const & target_name,
llvm::Value * ptr =nullptr
)
function errorPoisonNotAllowed
virtual void errorPoisonNotAllowed(
String const & target_name,
llvm::Value * ptr =nullptr
)
function errorUndefNotAllowed
virtual void errorUndefNotAllowed(
String const & target_name,
llvm::Value * ptr =nullptr
)
function errorExpectedStringValueForAttr
virtual void errorExpectedStringValueForAttr(
String const & function_name,
String const & attr_name
)
function warningWeakLinkReplacementNotPossible
virtual void warningWeakLinkReplacementNotPossible(
String const & function_name,
String const & replacement
)
function errorReplacementSignatureMismatch
virtual void errorReplacementSignatureMismatch(
String const & function_name,
String const & signature1,
String const & signature2
)
Protected Functions Documentation
function setHasErrors
void setHasErrors(
bool value
)
function setHasWarnings
void setHasWarnings(
bool value
)
Updated on 1 August 2023 at 16:25:10 UTC