Lines Matching defs:Loc
20 SourceLocation Loc = SM.getLocForStartOfFile(Offset.getFID());
21 Loc = Loc.getLocWithOffset(Offset.getOffset());
22 assert(Loc.isFileID());
23 return Loc;
27 SourceLocation Loc = getFileLocation(SM);
28 return CharSourceRange::getCharRange(Loc, Loc.getLocWithOffset(Length));
32 SourceLocation Loc = SM.getLocForStartOfFile(InsertFromRangeOffs.getFID());
33 Loc = Loc.getLocWithOffset(InsertFromRangeOffs.getOffset());
34 assert(Loc.isFileID());
35 return CharSourceRange::getCharRange(Loc, Loc.getLocWithOffset(Length));
43 bool Commit::insert(SourceLocation loc, StringRef text,
49 if ((!afterToken && !canInsert(loc, Offs)) ||
50 ( afterToken && !canInsertAfterToken(loc, Offs, loc))) {
55 addInsert(loc, Offs, text, beforePreviousInsertions);
59 bool Commit::insertFromRange(SourceLocation loc,
70 if ((!afterToken && !canInsert(loc, Offs)) ||
71 ( afterToken && !canInsertAfterToken(loc, Offs, loc))) {
77 PPRec->areInDifferentConditionalDirectiveRegion(loc, range.getBegin())) {
82 addInsertFromRange(loc, Offs, RangeOffs, RangeLen, beforePreviousInsertions);
160 bool Commit::replaceText(SourceLocation loc, StringRef text,
167 if (!canReplaceText(loc, replacementText, Offs, Len)) {
172 addRemove(loc, Offs, Len);
173 addInsert(loc, Offs, text, false);
220 bool Commit::canInsert(SourceLocation loc, FileOffset &offs) {
221 if (loc.isInvalid())
224 if (loc.isMacroID())
225 isAtStartOfMacroExpansion(loc, &loc);
228 while (SM.isMacroArgExpansion(loc))
229 loc = SM.getImmediateSpellingLoc(loc);
231 if (loc.isMacroID())
232 if (!isAtStartOfMacroExpansion(loc, &loc))
235 if (SM.isInSystemHeader(loc))
238 std::pair<FileID, unsigned> locInfo = SM.getDecomposedLoc(loc);
242 return canInsertInOffset(loc, offs);
245 bool Commit::canInsertAfterToken(SourceLocation loc, FileOffset &offs,
247 if (loc.isInvalid())
251 SourceLocation spellLoc = SourceMgr.getSpellingLoc(loc);
253 AfterLoc = loc.getLocWithOffset(tokLen);
255 if (loc.isMacroID())
256 isAtEndOfMacroExpansion(loc, &loc);
259 while (SM.isMacroArgExpansion(loc))
260 loc = SM.getImmediateSpellingLoc(loc);
262 if (loc.isMacroID())
263 if (!isAtEndOfMacroExpansion(loc, &loc))
266 if (SM.isInSystemHeader(loc))
269 loc = Lexer::getLocForEndOfToken(loc, 0, SourceMgr, LangOpts);
270 if (loc.isInvalid())
273 std::pair<FileID, unsigned> locInfo = SM.getDecomposedLoc(loc);
277 return canInsertInOffset(loc, offs);
322 bool Commit::canReplaceText(SourceLocation loc, StringRef text,
326 if (!canInsert(loc, Offs))
339 bool Commit::isAtStartOfMacroExpansion(SourceLocation loc,
341 return Lexer::isAtStartOfMacroExpansion(loc, SourceMgr, LangOpts, MacroBegin);
343 bool Commit::isAtEndOfMacroExpansion(SourceLocation loc,
345 return Lexer::isAtEndOfMacroExpansion(loc, SourceMgr, LangOpts, MacroEnd);