21 llvm::errs() <<
"Annotated testcase: " << Msg <<
"\n" << Code <<
"\n";
27 auto Require = [Text](
bool Assertion,
const char *Msg) {
33 Code.reserve(Text.
size());
34 while (!Text.
empty()) {
36 Points[Name.
getValueOr(
"")].push_back(Code.size());
45 Require(!Name,
"$name should be followed by ^ or [[");
47 Require(!OpenRanges.
empty(),
"unmatched ]]");
49 R.Begin = OpenRanges.
back().second;
51 Ranges[OpenRanges.
back().first].push_back(R);
60 Code.push_back(Text.
front());
63 Require(!Name,
"unterminated $name");
64 Require(OpenRanges.
empty(),
"unmatched [[");
68 auto I = Points.
find(Name);
70 "expected exactly one point", Code);
71 return I->getValue()[0];
76 return {
P.begin(),
P.end()};
80 auto I = Ranges.find(Name);
81 require(
I != Ranges.end() &&
I->getValue().size() == 1,
82 "expected exactly one range", Code);
83 return I->getValue()[0];
86 std::vector<Annotations::Range>
88 auto R = Ranges.lookup(Name);
89 return {R.begin(), R.end()};
reference emplace_back(ArgTypes &&... Args)
raw_ostream & errs()
This returns a reference to a raw_ostream for standard error.
This class represents lattice values for constants.
size_t point(llvm::StringRef Name="") const
Returns the position of the point marked by ^ (or $name^) in the text.
amdgpu Simplify well known AMD library false FunctionCallee Value const Twine & Name
constexpr T getValueOr(U &&value) const LLVM_LVALUE_FUNCTION
bool consume_front(StringRef Prefix)
Returns true if this StringRef has the given prefix and removes that prefix.
iterator find(StringRef Key)
auto formatv(const char *Fmt, Ts &&... Vals) -> formatv_object< decltype(std::make_tuple(detail::build_format_adapter(std::forward< Ts >(Vals))...))>
bool isAlnum(char C)
Checks whether character C is either a decimal digit or an uppercase or lowercase letter as classifie...
LLVM_NODISCARD StringRef drop_front(size_t N=1) const
Return a StringRef equal to 'this' but with the first N elements dropped.
Range range(llvm::StringRef Name="") const
Returns the location of the range marked by [[ ]] (or $name[[ ]]).
LLVM_NODISCARD bool empty() const
empty - Check if the string is empty.
LLVM_NODISCARD StringRef take_while(function_ref< bool(char)> F) const
Return the longest prefix of 'this' such that every character in the prefix satisfies the given predi...
LLVM_NODISCARD size_t size() const
size - Get the string size.
std::vector< size_t > points(llvm::StringRef Name="") const
Returns the position of all points marked by ^ (or $name^) in the text.
std::vector< Range > ranges(llvm::StringRef Name="") const
Returns the location of all ranges marked by [[ ]] (or $name[[ ]]).
ValueTy lookup(StringRef Key) const
lookup - Return the entry for the specified key, or a default constructed value if no such entry exis...
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
static void require(bool Assertion, const char *Msg, llvm::StringRef Code)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
Annotations(llvm::StringRef Text)
Parses the annotations from Text. Crashes if it's malformed.
LLVM_NODISCARD bool empty() const
raw_ostream & operator<<(raw_ostream &OS, const APInt &I)
LLVM_NODISCARD char front() const
front - Get the first character in the string.
Two offsets pointing to a continuous substring.
This class implements an extremely fast bulk output stream that can only output to a stream...
StringRef - Represent a constant reference to a string, i.e.