Lines Matching refs:SM

43                                        const SourceManager &SM,  in getImmediateMacroName()  argument
47 while (SM.isMacroArgExpansion(Loc)) in getImmediateMacroName()
48 Loc = SM.getImmediateExpansionRange(Loc).first; in getImmediateMacroName()
52 if (!SM.getFileEntryForID(SM.getFileID(SM.getSpellingLoc(Loc)))) in getImmediateMacroName()
58 Loc = SM.getSpellingLoc(SM.getImmediateExpansionRange(Loc).first); in getImmediateMacroName()
62 std::pair<FileID, unsigned> ExpansionInfo = SM.getDecomposedLoc(Loc); in getImmediateMacroName()
63 unsigned MacroTokenLength = Lexer::MeasureTokenLength(Loc, SM, LangOpts); in getImmediateMacroName()
64 StringRef ExpansionBuffer = SM.getBufferData(ExpansionInfo.first); in getImmediateMacroName()
93 const SourceManager &SM, const LangOptions &LangOpts, in mergeFixits() argument
95 edit::Commit commit(SM, LangOpts); in mergeFixits()
116 edit::EditedSource Editor(SM, LangOpts); in mergeFixits()
128 const SourceManager *SM, in emitDiagnostic() argument
130 assert(SM || Loc.isInvalid()); in emitDiagnostic()
136 emitDiagnosticMessage(Loc, PresumedLoc(), Level, Message, Ranges, SM, D); in emitDiagnostic()
144 mergeFixits(FixItHints, *SM, LangOpts, MergedFixits); in emitDiagnostic()
157 Loc = SM->getFileLoc(Loc); in emitDiagnostic()
159 PresumedLoc PLoc = SM->getPresumedLoc(Loc, DiagOpts->ShowPresumedLoc); in emitDiagnostic()
163 emitIncludeStack(Loc, PLoc, Level, *SM); in emitDiagnostic()
166 emitDiagnosticMessage(Loc, PLoc, Level, Message, Ranges, SM, D); in emitDiagnostic()
167 emitCaret(Loc, Level, MutableRanges, FixItHints, *SM); in emitDiagnostic()
172 emitMacroExpansions(UnexpandedLoc, Level, MutableRanges, FixItHints, *SM); in emitDiagnostic()
211 const SourceManager &SM) { in emitIncludeStack() argument
224 emitIncludeStackRecursively(IncludeLoc, SM); in emitIncludeStack()
226 emitModuleBuildStack(SM); in emitIncludeStack()
227 emitImportStack(Loc, SM); in emitIncludeStack()
234 const SourceManager &SM) { in emitIncludeStackRecursively() argument
236 emitModuleBuildStack(SM); in emitIncludeStackRecursively()
240 PresumedLoc PLoc = SM.getPresumedLoc(Loc, DiagOpts->ShowPresumedLoc); in emitIncludeStackRecursively()
247 std::pair<SourceLocation, StringRef> Imported = SM.getModuleImportLoc(Loc); in emitIncludeStackRecursively()
250 emitImportStackRecursively(Imported.first, Imported.second, SM); in emitIncludeStackRecursively()
255 emitIncludeStackRecursively(PLoc.getIncludeLoc(), SM); in emitIncludeStackRecursively()
258 emitIncludeLocation(Loc, PLoc, SM); in emitIncludeStackRecursively()
263 const SourceManager &SM) { in emitImportStack() argument
265 emitModuleBuildStack(SM); in emitImportStack()
270 = SM.getModuleImportLoc(Loc); in emitImportStack()
271 emitImportStackRecursively(NextImportLoc.first, NextImportLoc.second, SM); in emitImportStack()
278 const SourceManager &SM) { in emitImportStackRecursively() argument
283 PresumedLoc PLoc = SM.getPresumedLoc(Loc, DiagOpts->ShowPresumedLoc); in emitImportStackRecursively()
287 = SM.getModuleImportLoc(Loc); in emitImportStackRecursively()
288 emitImportStackRecursively(NextImportLoc.first, NextImportLoc.second, SM); in emitImportStackRecursively()
291 emitImportLocation(Loc, PLoc, ModuleName, SM); in emitImportStackRecursively()
296 void DiagnosticRenderer::emitModuleBuildStack(const SourceManager &SM) { in emitModuleBuildStack() argument
297 ModuleBuildStack Stack = SM.getModuleBuildStack(); in emitModuleBuildStack()
315 bool IsBegin, const SourceManager *SM) { in retrieveMacroLocation() argument
316 assert(SM->getFileID(Loc) == MacroFileID); in retrieveMacroLocation()
324 if (SM->isMacroArgExpansion(Loc)) { in retrieveMacroLocation()
329 MacroLocation = SM->getImmediateSpellingLoc(Loc); in retrieveMacroLocation()
330 MacroArgLocation = IsBegin ? SM->getImmediateExpansionRange(Loc).first in retrieveMacroLocation()
331 : SM->getImmediateExpansionRange(Loc).second; in retrieveMacroLocation()
333 MacroLocation = IsBegin ? SM->getImmediateExpansionRange(Loc).first in retrieveMacroLocation()
334 : SM->getImmediateExpansionRange(Loc).second; in retrieveMacroLocation()
335 MacroArgLocation = SM->getImmediateSpellingLoc(Loc); in retrieveMacroLocation()
339 MacroFileID = SM->getFileID(MacroLocation); in retrieveMacroLocation()
342 CommonArgExpansions, IsBegin, SM); in retrieveMacroLocation()
347 MacroFileID = SM->getFileID(MacroArgLocation); in retrieveMacroLocation()
349 CommonArgExpansions, IsBegin, SM); in retrieveMacroLocation()
356 bool IsBegin, const SourceManager *SM) { in getMacroArgExpansionFileIDs() argument
358 if (SM->isMacroArgExpansion(Loc)) { in getMacroArgExpansionFileIDs()
359 IDs.push_back(SM->getFileID(Loc)); in getMacroArgExpansionFileIDs()
360 Loc = SM->getImmediateSpellingLoc(Loc); in getMacroArgExpansionFileIDs()
362 auto ExpRange = SM->getImmediateExpansionRange(Loc); in getMacroArgExpansionFileIDs()
371 SourceLocation Begin, SourceLocation End, const SourceManager *SM, in computeCommonMacroArgExpansionFileIDs() argument
375 getMacroArgExpansionFileIDs(Begin, BeginArgExpansions, /*IsBegin=*/true, SM); in computeCommonMacroArgExpansionFileIDs()
376 getMacroArgExpansionFileIDs(End, EndArgExpansions, /*IsBegin=*/false, SM); in computeCommonMacroArgExpansionFileIDs()
398 const SourceManager *SM) { in mapDiagnosticRanges() argument
399 FileID CaretLocFileID = SM->getFileID(CaretLoc); in mapDiagnosticRanges()
407 FileID BeginFileID = SM->getFileID(Begin); in mapDiagnosticRanges()
408 FileID EndFileID = SM->getFileID(End); in mapDiagnosticRanges()
416 Begin = SM->getImmediateExpansionRange(Begin).first; in mapDiagnosticRanges()
417 BeginFileID = SM->getFileID(Begin); in mapDiagnosticRanges()
423 End = SM->getImmediateExpansionRange(End).second; in mapDiagnosticRanges()
424 EndFileID = SM->getFileID(End); in mapDiagnosticRanges()
434 computeCommonMacroArgExpansionFileIDs(Begin, End, SM, CommonArgExpansions); in mapDiagnosticRanges()
436 CommonArgExpansions, /*IsBegin=*/true, SM); in mapDiagnosticRanges()
438 CommonArgExpansions, /*IsBegin=*/false, SM); in mapDiagnosticRanges()
442 Begin = SM->getSpellingLoc(Begin); in mapDiagnosticRanges()
443 End = SM->getSpellingLoc(End); in mapDiagnosticRanges()
454 const SourceManager &SM) { in emitCaret() argument
456 mapDiagnosticRanges(Loc, Ranges, SpellingRanges, &SM); in emitCaret()
457 emitCodeContext(Loc, Level, SpellingRanges, Hints, SM); in emitCaret()
466 const SourceManager &SM) { in emitSingleMacroExpansion() argument
469 SourceLocation SpellingLoc = SM.getSpellingLoc(Loc); in emitSingleMacroExpansion()
473 mapDiagnosticRanges(Loc, Ranges, SpellingRanges, &SM); in emitSingleMacroExpansion()
477 StringRef MacroName = getImmediateMacroName(Loc, SM, LangOpts); in emitSingleMacroExpansion()
484 SpellingRanges, None, &SM); in emitSingleMacroExpansion()
491 const SourceManager &SM, in checkLocForMacroArgExpansion() argument
494 if (SM.isMacroArgExpansion(Loc, &MacroLoc)) { in checkLocForMacroArgExpansion()
504 const SourceManager &SM, in checkRangeForMacroArgExpansion() argument
508 if (!checkLocForMacroArgExpansion(BegLoc, SM, ArgumentLoc)) in checkRangeForMacroArgExpansion()
513 return checkLocForMacroArgExpansion(BegLoc, SM, ArgumentLoc); in checkRangeForMacroArgExpansion()
520 const SourceManager &SM) { in checkRangesForMacroArgExpansion() argument
524 mapDiagnosticRanges(Loc, Ranges, SpellingRanges, &SM); in checkRangesForMacroArgExpansion()
539 if (!SM.isMacroArgExpansion(Loc,&ArgumentLoc)) in checkRangesForMacroArgExpansion()
543 if (!checkRangeForMacroArgExpansion(*I, SM, ArgumentLoc)) in checkRangesForMacroArgExpansion()
565 const SourceManager &SM) { in emitMacroExpansions() argument
574 if (SM.isMacroArgExpansion(Loc)) in emitMacroExpansions()
575 LocationStack.push_back(SM.getImmediateExpansionRange(Loc).first); in emitMacroExpansions()
579 if (checkRangesForMacroArgExpansion(Loc, Ranges, SM)) in emitMacroExpansions()
582 Loc = SM.getImmediateMacroCallerLoc(Loc); in emitMacroExpansions()
588 Loc = SM.getImmediateMacroCallerLoc(LocationStack.back()); in emitMacroExpansions()
600 emitSingleMacroExpansion(*I, Level, Ranges, SM); in emitMacroExpansions()
610 emitSingleMacroExpansion(*I, Level, Ranges, SM); in emitMacroExpansions()
622 emitSingleMacroExpansion(*I, Level, Ranges, SM); in emitMacroExpansions()
629 const SourceManager &SM) { in emitIncludeLocation() argument
635 emitNote(Loc, Message.str(), &SM); in emitIncludeLocation()
641 const SourceManager &SM) { in emitImportLocation() argument
650 emitNote(Loc, Message.str(), &SM); in emitImportLocation()
657 const SourceManager &SM) { in emitBuildingModuleLocation() argument
666 emitNote(Loc, Message.str(), &SM); in emitBuildingModuleLocation()