LLVM: lib/Frontend/OpenMP/DirectiveNameParser.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
14
15#include
16#include
17
20
21
24 if (D == Directive::OMPD_unknown || !(getDirectiveLanguages(D) & L))
25 continue;
27 insertName(getOpenMPDirectiveName(D, Ver), D);
28 }
29}
30
33 if (!Current)
34 return Current;
35 assert(Current->isValid() && "Invalid input state");
36 if (const State *Next = Current->next(Tok))
37 return Next->isValid() ? Next : nullptr;
38 return nullptr;
39}
40
46
48 State *Where = &InitialState;
49
51 Where = insertTransition(Where, Tok);
52
53 Where->Value = D;
54}
55
56DirectiveNameParser::State *
57DirectiveNameParser::insertTransition(State *From, StringRef Tok) {
58 assert(From && "Expecting state");
59 if (!From->Transition)
60 From->Transition = std::make_uniqueState::TransitionMapTy();
61 if (State *Next = From->next(Tok))
63
64 auto [Where, DidIt] = From->Transition->try_emplace(Tok, State());
65 assert(DidIt && "Map insertion failed");
66 return &Where->second;
67}
68
69const DirectiveNameParser::State *
70DirectiveNameParser::State::next(StringRef Tok) const {
71 if (!Transition)
72 return nullptr;
73 auto F = Transition->find(Tok);
74 return F != Transition->end() ? &F->second : nullptr;
75}
76
77DirectiveNameParser::State *DirectiveNameParser::State::next(StringRef Tok) {
78 if (!Transition)
79 return nullptr;
80 auto F = Transition->find(Tok);
81 return F != Transition->end() ? &F->second : nullptr;
82}
83}
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
Provides some synthesis utilities to produce sequences of values.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
LLVM_ABI ArrayRef< unsigned > getOpenMPVersions()
LLVM_ABI void SplitString(StringRef Source, SmallVectorImpl< StringRef > &OutFragments, StringRef Delimiters=" \t\n\v\f\r")
SplitString - Split up the specified string according to the specified delimiters,...
FunctionAddr VTableAddr Next
auto seq(T Begin, T End)
Iterate over an integral type from Begin up to - but not including - End.
static LLVM_ABI SmallVector< StringRef > tokenize(StringRef N)
Definition DirectiveNameParser.cpp:41
LLVM_ABI const State * consume(const State *Current, StringRef Tok) const
Definition DirectiveNameParser.cpp:32
LLVM_ABI DirectiveNameParser(SourceLanguage L=SourceLanguage::C)
Definition DirectiveNameParser.cpp:19