LLVM: llvm::omp::DirectiveNameParser Struct Reference (original) (raw)

Parser class for OpenMP directive names.

It only recognizes names listed in OMP.td, in particular it does not recognize Fortran's end-directives if they are not explicitly listed in OMP.td.

The class itself may be a singleton, once it's constructed it never changes.

Usage: { DirectiveNameParser Parser; // Could be static const.

DirectiveNameParser::State *S = Parser.initial(); for (StringRef Token : Tokens) S = Parser.consume(S, Token); // Passing nullptr is ok.

if (S == nullptr) { // Error: ended up in a state from which there is no possible path // to a successful parse. } else if (S->Value == OMPD_unknown) { // Parsed a sequence of tokens that are not a complete name, but // parsing more tokens could lead to a successful parse. } else { // Success. ParsedId = S->Value; } }

Definition at line 47 of file DirectiveNameParser.h.