16#ifndef LLVM_SUPPORT_SOURCEMGRDIAGNOSTICVERIFIER_H
17#define LLVM_SUPPORT_SOURCEMGRDIAGNOSTICVERIFIER_H
71 const Twine &msg)
const;
98 std::optional<MutableArrayRef<ExpectedDiag>>
103 return expectedUnknownLocDiags;
118 StringRef message,
bool reportUnexpected =
true);
128 Regex expected{
"expected-(error|note|remark|warning)(-re)? "
129 "*(@([+-][0-9]+|above|below|unknown))? *{{(.*)}}$"};
133 StringMap<SmallVector<ExpectedDiag, 2>> expectedDiagsPerFile;
136 SmallVector<ExpectedDiag, 2> expectedUnknownLocDiags;
This file defines the StringMap class.
bool hasLoc(const Instruction &I)
This file defines the SmallVector class.
This interface provides simple read-only access to a block of memory, and provides simple methods for...
Represent a mutable reference to an array (0 or more elements consecutively in memory),...
Represents a location in source code.
MatchResult
The result of matching a single actual diagnostic against the expected diagnostics recorded for its l...
@ Matched
The diagnostic matched an expected diagnostic (kind and text).
@ Unexpected
The diagnostic did not match any expected diagnostic.
@ Ignored
The diagnostic did not match, but reportUnexpected was false, so nothing was printed and nothing need...
@ NearMiss
The diagnostic's text matched an expected diagnostic, but its kind didn't; a message about this has a...
MutableArrayRef< ExpectedDiag > getExpectedUnknownLocDiags()
Returns the expected diagnostics with an '@unknown' location.
MutableArrayRef< ExpectedDiag > computeExpectedDiags(raw_ostream &os, SourceMgr &mgr, const MemoryBuffer *buf)
Computes and caches the list of expected diagnostics for buf, if not already cached.
std::optional< MutableArrayRef< ExpectedDiag > > getExpectedDiags(StringRef bufName)
Returns the cached expected diagnostics for the buffer named bufName, or std::nullopt if computeExpec...
SourceMgrDiagnosticVerifier()=default
This owns the files read by a parser, handles include stacks, and handles diagnostic wrangling.
Represent a constant reference to a string, i.e.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
This class implements an extremely fast bulk output stream that can only output to a stream.
bool match(Val *V, const Pattern &P)
This is an optimization pass for GlobalISel generic memory operations.
std::optional< Regex > substringRegex
An optional regex matcher, if the expected diagnostic substring was a regex string.
StringRef substring
The substring that is expected to be within the diagnostic.
ExpectedDiag(SourceMgr::DiagKind kind, unsigned lineNo, SMLoc fileLoc, StringRef substring)
SourceMgr::DiagKind kind
The severity of the diagnostic expected.
SMLoc fileLoc
The location of the expected diagnostic within the input file.
unsigned lineNo
The line number the expected diagnostic should be on.
bool matched
A flag indicating if the expected diagnostic has been matched yet.