14 #ifndef LLVM_CLANG_AST_COMMENTLEXER_H 15 #define LLVM_CLANG_AST_COMMENTLEXER_H 19 #include "llvm/ADT/SmallString.h" 20 #include "llvm/ADT/StringRef.h" 21 #include "llvm/Support/Allocator.h" 22 #include "llvm/Support/raw_ostream.h" 28 class TextTokenRetokenizer;
85 if (Length == 0 || Length == 1)
96 unsigned getLength() const LLVM_READONLY {
return Length; }
101 return StringRef(TextPtr, IntVal);
106 TextPtr = Text.data();
107 IntVal = Text.size();
112 return StringRef(TextPtr, IntVal);
117 TextPtr = Name.data();
118 IntVal = Name.size();
143 return StringRef(TextPtr, IntVal);
148 TextPtr = Text.data();
149 IntVal = Text.size();
164 return StringRef(TextPtr, IntVal);
169 TextPtr = Text.data();
170 IntVal = Text.size();
175 return StringRef(TextPtr, IntVal);
180 TextPtr = Name.data();
181 IntVal = Name.size();
186 return StringRef(TextPtr, IntVal);
191 TextPtr = Name.data();
192 IntVal = Name.size();
197 return StringRef(TextPtr, IntVal);
202 TextPtr = Str.data();
208 return StringRef(TextPtr, IntVal);
213 TextPtr = Name.data();
214 IntVal = Name.size();
224 void operator=(
const Lexer &) =
delete;
228 llvm::BumpPtrAllocator &Allocator;
234 const char *
const BufferStart;
235 const char *
const BufferEnd;
238 const char *BufferPtr;
242 const char *CommentEnd;
244 enum LexerCommentState {
246 LCS_InsideBCPLComment,
252 LexerCommentState CommentState;
260 LS_VerbatimBlockFirstLine,
264 LS_VerbatimBlockBody,
286 StringRef resolveHTMLNamedCharacterReference(StringRef Name)
const;
289 StringRef resolveHTMLDecimalCharacterReference(StringRef Name)
const;
292 StringRef resolveHTMLHexCharacterReference(StringRef Name)
const;
294 void formTokenWithChars(
Token &Result,
const char *TokEnd,
297 void formTextToken(
Token &Result,
const char *TokEnd) {
298 StringRef
Text(BufferPtr, TokEnd - BufferPtr);
299 formTokenWithChars(Result, TokEnd,
tok::text);
304 assert(Loc >= BufferStart && Loc <= BufferEnd &&
305 "Location out of range for this buffer!");
307 const unsigned CharNo = Loc - BufferStart;
312 return Diags.
Report(Loc, DiagID);
316 void skipLineStartingDecorations();
319 void lexCommentText(
Token &
T);
321 void setupAndLexVerbatimBlock(
Token &T,
322 const char *TextBegin,
325 void lexVerbatimBlockFirstLine(
Token &T);
327 void lexVerbatimBlockBody(
Token &T);
329 void setupAndLexVerbatimLine(
Token &T,
const char *TextBegin,
332 void lexVerbatimLineText(
Token &T);
334 void lexHTMLCharacterReference(
Token &T);
336 void setupAndLexHTMLStartTag(
Token &T);
338 void lexHTMLStartTag(
Token &T);
340 void setupAndLexHTMLEndTag(
Token &T);
342 void lexHTMLEndTag(
Token &T);
348 const char *BufferStart,
const char *BufferEnd);
352 StringRef getSpelling(
const Token &
Tok,
354 bool *Invalid =
nullptr)
const;
static DiagnosticBuilder Diag(DiagnosticsEngine *Diags, const LangOptions &Features, FullSourceLoc TokLoc, const char *TokBegin, const char *TokRangeBegin, const char *TokRangeEnd, unsigned DiagID)
Produce a diagnostic highlighting some portion of a literal.
SourceLocation getLocWithOffset(int Offset) const
Return a source location with the specified offset from this SourceLocation.
Defines the SourceManager interface.
DiagnosticBuilder Report(SourceLocation Loc, unsigned DiagID)
Issue the message to the client.
static void dump(llvm::raw_ostream &OS, StringRef FunctionName, ArrayRef< CounterExpression > Expressions, ArrayRef< CounterMappingRegion > Regions)
Concrete class used by the front-end to report problems and issues.
Defines the Diagnostic-related interfaces.
A little helper class used to produce diagnostics.
const FunctionProtoType * T
Encodes a location in the source.
Dataflow Directional Tag Classes.
This class handles loading and caching of source files into memory.