|
LLVM 24.0.0git
|
A single diagnostic expected via an 'expected-<kind>' comment. More...
#include "llvm/Support/SourceMgrDiagnosticVerifier.h"
Public Member Functions | |
| ExpectedDiag (SourceMgr::DiagKind kind, unsigned lineNo, SMLoc fileLoc, StringRef substring) | |
| LLVM_ABI bool | match (StringRef str) const |
| Returns true if this diagnostic matches the given message. | |
| LLVM_ABI bool | computeRegex (raw_ostream &os, SourceMgr &mgr) |
| Computes the regex matcher for a '-re' diagnostic's substring. | |
| LLVM_ABI bool | emitError (raw_ostream &os, SourceMgr &mgr, const Twine &msg) const |
Prints msg at this diagnostic's location and returns false, for use as return emitError(...); in functions that report failure via a bool return. | |
Public Attributes | |
| SourceMgr::DiagKind | kind |
| The severity of the diagnostic expected. | |
| unsigned | lineNo |
| The line number the expected diagnostic should be on. | |
| SMLoc | fileLoc |
| The location of the expected diagnostic within the input file. | |
| bool | matched = false |
| A flag indicating if the expected diagnostic has been matched yet. | |
| StringRef | substring |
| The substring that is expected to be within the diagnostic. | |
| std::optional< Regex > | substringRegex |
| An optional regex matcher, if the expected diagnostic substring was a regex string. | |
A single diagnostic expected via an 'expected-<kind>' comment.
Definition at line 55 of file SourceMgrDiagnosticVerifier.h.
|
inline |
| bool SourceMgrDiagnosticVerifier::ExpectedDiag::computeRegex | ( | raw_ostream & | os, |
| SourceMgr & | mgr ) |
Computes the regex matcher for a '-re' diagnostic's substring.
Returns false and prints a message through mgr on error.
Definition at line 50 of file SourceMgrDiagnosticVerifier.cpp.
References llvm::StringRef::drop_front(), emitError(), llvm::StringRef::empty(), llvm::Regex::escape(), llvm::StringRef::find(), isValid(), llvm::StringRef::npos, substring, substringRegex, and llvm::StringRef::take_front().
Referenced by llvm::SourceMgrDiagnosticVerifier::computeExpectedDiags().
| bool SourceMgrDiagnosticVerifier::ExpectedDiag::emitError | ( | raw_ostream & | os, |
| SourceMgr & | mgr, | ||
| const Twine & | msg ) const |
Prints msg at this diagnostic's location and returns false, for use as return emitError(...); in functions that report failure via a bool return.
Definition at line 30 of file SourceMgrDiagnosticVerifier.cpp.
References llvm::SourceMgr::DK_Error, fileLoc, llvm::SMLoc::getFromPointer(), llvm::SourceMgr::PrintMessage(), and substring.
Referenced by computeRegex().
Returns true if this diagnostic matches the given message.
Definition at line 42 of file SourceMgrDiagnosticVerifier.cpp.
References llvm::StringRef::contains(), substring, and substringRegex.
| SMLoc llvm::SourceMgrDiagnosticVerifier::ExpectedDiag::fileLoc |
The location of the expected diagnostic within the input file.
Definition at line 78 of file SourceMgrDiagnosticVerifier.h.
Referenced by llvm::SourceMgrDiagnosticVerifier::computeExpectedDiags(), emitError(), ExpectedDiag(), and llvm::SourceMgrDiagnosticVerifier::process().
| SourceMgr::DiagKind llvm::SourceMgrDiagnosticVerifier::ExpectedDiag::kind |
The severity of the diagnostic expected.
Definition at line 74 of file SourceMgrDiagnosticVerifier.h.
Referenced by ExpectedDiag(), and llvm::SourceMgrDiagnosticVerifier::process().
| unsigned llvm::SourceMgrDiagnosticVerifier::ExpectedDiag::lineNo |
The line number the expected diagnostic should be on.
Definition at line 76 of file SourceMgrDiagnosticVerifier.h.
Referenced by llvm::SourceMgrDiagnosticVerifier::computeExpectedDiags(), and ExpectedDiag().
| bool llvm::SourceMgrDiagnosticVerifier::ExpectedDiag::matched = false |
A flag indicating if the expected diagnostic has been matched yet.
Definition at line 80 of file SourceMgrDiagnosticVerifier.h.
| StringRef llvm::SourceMgrDiagnosticVerifier::ExpectedDiag::substring |
The substring that is expected to be within the diagnostic.
Definition at line 82 of file SourceMgrDiagnosticVerifier.h.
Referenced by computeRegex(), emitError(), ExpectedDiag(), and match().
| std::optional<Regex> llvm::SourceMgrDiagnosticVerifier::ExpectedDiag::substringRegex |
An optional regex matcher, if the expected diagnostic substring was a regex string.
Definition at line 85 of file SourceMgrDiagnosticVerifier.h.
Referenced by computeRegex(), and match().