Home | History | Annotate | Download | only in Lex

Lines Matching full:loc

168 /// spelling loc that indicates the bytes to be lexed for the token and an
299 StringRef Lexer::getSpelling(SourceLocation loc,
305 std::pair<FileID, unsigned> locInfo = SM.getDecomposedLoc(loc);
420 unsigned Lexer::MeasureTokenLength(SourceLocation Loc,
424 if (getRawToken(Loc, TheTok, SM, LangOpts))
431 bool Lexer::getRawToken(SourceLocation Loc, Token &Result,
442 Loc = SM.getExpansionLoc(Loc);
443 std::pair<FileID, unsigned> LocInfo = SM.getDecomposedLoc(Loc);
462 static SourceLocation getBeginningOfFileToken(SourceLocation Loc,
465 assert(Loc.isFileID());
466 std::pair<FileID, unsigned> LocInfo = SM.getDecomposedLoc(Loc);
468 return Loc;
473 return Loc;
479 return Loc;
483 return Loc;
496 SourceLocation LexerStartLoc = Loc.getLocWithOffset(-LocInfo.second);
519 return Loc;
522 SourceLocation Lexer::GetBeginningOfToken(SourceLocation Loc,
525 if (Loc.isFileID())
526 return getBeginningOfFileToken(Loc, SM, LangOpts);
528 if (!SM.isMacroArgExpansion(Loc))
529 return Loc;
531 SourceLocation FileLoc = SM.getSpellingLoc(Loc);
538 return Loc.getLocWithOffset(BeginFileLocInfo.second - FileLocInfo.second);
762 /// points just past the end of the token referenced by \p Loc, and
773 SourceLocation Lexer::getLocForEndOfToken(SourceLocation Loc, unsigned Offset,
776 if (Loc.isInvalid())
779 if (Loc.isMacroID()) {
780 if (Offset > 0 || !isAtEndOfMacroExpansion(Loc, SM, LangOpts, &Loc))
784 unsigned Len = Lexer::MeasureTokenLength(Loc, SM, LangOpts);
788 return Loc;
790 return Loc.getLocWithOffset(Len);
795 bool Lexer::isAtStartOfMacroExpansion(SourceLocation loc,
799 assert(loc.isValid() && loc.isMacroID() && "Expected a valid macro loc");
802 if (!SM.isAtStartOfImmediateMacroExpansion(loc, &expansionLoc))
817 bool Lexer::isAtEndOfMacroExpansion(SourceLocation loc,
821 assert(loc.isValid() && loc.isMacroID() && "Expected a valid macro loc");
823 SourceLocation spellLoc = SM.getSpellingLoc(loc);
828 SourceLocation afterLoc = loc.getLocWithOffset(tokLen);
970 StringRef Lexer::getImmediateMacroName(SourceLocation Loc,
973 assert(Loc.isMacroID() && "Only reasonble to call this on macros");
977 FileID FID = SM.getFileID(Loc);
980 Loc = Expansion.getExpansionLocStart();
987 // Loc points to the argument id of the macro definition, move to the
989 Loc = SM.getImmediateExpansionRange(Loc).first;
996 FileID MacroFID = SM.getFileID(Loc);
1001 Loc = SpellLoc;
1007 Loc = SM.getSpellingLoc(Loc);
1011 std::pair<FileID, unsigned> ExpansionInfo = SM.getDecomposedLoc(Loc);
1012 unsigned MacroTokenLength = Lexer::MeasureTokenLength(Loc, SM, LangOpts);
1047 // Figure out the expansion loc range, which is the range covered by the
1057 SourceLocation Lexer::getSourceLocation(const char *Loc,
1059 assert(Loc >= BufferStart && Loc <= BufferEnd &&
1064 unsigned CharNo = Loc-BufferStart;
1076 DiagnosticBuilder Lexer::Diag(const char *Loc, unsigned DiagID) const {
1077 return PP->Diag(getSourceLocation(Loc), DiagID);
1170 SourceLocation Lexer::findLocationAfterToken(SourceLocation Loc,
1175 if (Loc.isMacroID()) {
1176 if (!Lexer::isAtEndOfMacroExpansion(Loc, SM, LangOpts, &Loc))
1179 Loc = Lexer::getLocForEndOfToken(Loc, 0, SM, LangOpts);
1182 std::pair<FileID, unsigned> LocInfo = SM.getDecomposedLoc(Loc);
2563 SourceLocation Loc = FileLoc.getLocWithOffset(CurPtr-BufferStart);
2564 return Loc == PP->getCodeCompletionLoc();