LLVM: include/llvm/AsmParser/LLLexer.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13#ifndef LLVM_ASMPARSER_LLLEXER_H
14#define LLVM_ASMPARSER_LLLEXER_H
15
21#include
22
23namespace llvm {
27
29 const char *CurPtr;
31
32
33 const char *PrevTokEnd = nullptr;
34
35 enum class ErrorPriority {
36 None,
37 Parser,
38 Lexer,
39 };
40
41 struct ErrorInfo {
42 ErrorPriority Priority = ErrorPriority::None;
44
46 } ErrorInfo;
47
50
51
52 const char *TokStart;
54 std::string StrVal;
55 unsigned UIntVal = 0;
56 Type *TyVal = nullptr;
59
60
61
62 bool IgnoreColonInIdentifiers = false;
63
64 public:
67
69
73 const std::string &getStrVal() const { return StrVal; }
75 unsigned getUIntVal() const { return UIntVal; }
78
80 IgnoreColonInIdentifiers = val;
81 }
82
83
84
87 return {LC.first - 1, LC.second - 1};
88 }
89
90
93 return {LC.first - 1, LC.second - 1};
94 }
95
96
97
99 Error(ErrorLoc, Msg, ErrorPriority::Parser);
100 return true;
101 }
103
106
107 private:
109
110 int getNextChar();
111 void SkipLineComment();
112 bool SkipCComment();
114 bool ReadVarName();
115
129
130 uint64_t atoull(const char *Buffer, const char *End);
131 uint64_t HexIntToVal(const char *Buffer, const char *End);
132 void HexToIntPair(const char *Buffer, const char *End, uint64_t Pair[2]);
133 void FP80HexToIntPair(const char *Buffer, const char *End,
135
136 void Error(LocTy ErrorLoc, const Twine &Msg, ErrorPriority Origin);
137
138 void LexError(LocTy ErrorLoc, const Twine &Msg) {
139 Error(ErrorLoc, Msg, ErrorPriority::Lexer);
140 }
141 void LexError(const Twine &Msg) { LexError(getLoc(), Msg); }
142 };
143}
144
145#endif
This file declares a class to represent arbitrary precision floating point values and provide a varie...
This file implements the APSInt class, which is a simple class that represents an arbitrary sized int...
An arbitrary precision integer that knows its signedness.
bool ParseError(LocTy ErrorLoc, const Twine &Msg)
Definition LLLexer.h:98
lltok::Kind Lex()
Definition LLLexer.h:68
unsigned getUIntVal() const
Definition LLLexer.h:75
lltok::Kind getKind() const
Definition LLLexer.h:72
std::pair< unsigned, unsigned > getPrevTokEndLineColumnPos()
Get the line, column position of the end of the previous token, zero-indexed exclusive.
Definition LLLexer.h:91
const std::string & getStrVal() const
Definition LLLexer.h:73
LLLexer(StringRef StartBuf, SourceMgr &SM, SMDiagnostic &, LLVMContext &C)
void Warning(const Twine &Msg) const
Definition LLLexer.h:105
Type * getTyVal() const
Definition LLLexer.h:74
LocTy getLoc() const
Definition LLLexer.h:71
SMLoc LocTy
Definition LLLexer.h:70
std::pair< unsigned, unsigned > getTokLineColumnPos()
Get the line, column position of the start of the current token, zero-indexed.
Definition LLLexer.h:85
const APSInt & getAPSIntVal() const
Definition LLLexer.h:76
void setIgnoreColonInIdentifiers(bool val)
Definition LLLexer.h:79
const APFloat & getAPFloatVal() const
Definition LLLexer.h:77
bool ParseError(const Twine &Msg)
Definition LLLexer.h:102
This is an important class for using LLVM in a threaded context.
Instances of this class encapsulate one diagnostic report, allowing printing to a raw_ostream as a ca...
Represents a location in source code.
static SMLoc getFromPointer(const char *Ptr)
This owns the files read by a parser, handles include stacks, and handles diagnostic wrangling.
StringRef - Represent a constant reference to a string, i.e.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
The instances of the Type class are immutable: once they are created, they are never changed.
@ C
The default llvm calling convention, compatible with C.
This is an optimization pass for GlobalISel generic memory operations.
std::tuple< const DIScope *, const DIScope *, const DILocalVariable * > VarID
A unique key that represents a debug variable.