@@ -1275,43 +1275,24 @@ class SourceManager : public RefCountedBase<SourceManager> {
12751275 // / start of the buffer of the location.
12761276 FileIDAndOffset getDecomposedLoc (SourceLocation Loc) const {
12771277 FileID FID = getFileID (Loc);
1278- auto *Entry = getSLocEntryOrNull (FID);
1279- if (!Entry)
1280- return std::make_pair (FileID (), 0 );
1281- return std::make_pair (FID, Loc.getOffset () - Entry->getOffset ());
1278+ const SrcMgr::SLocEntry &Entry = getSLocEntry (FID);
1279+ return std::make_pair (FID, Loc.getOffset () - Entry.getOffset ());
12821280 }
12831281
12841282 // / Decompose the specified location into a raw FileID + Offset pair.
12851283 // /
12861284 // / If the location is an expansion record, walk through it until we find
12871285 // / the final location expanded.
12881286 FileIDAndOffset getDecomposedExpansionLoc (SourceLocation Loc) const {
1289- FileID FID = getFileID (Loc);
1290- auto *E = getSLocEntryOrNull (FID);
1291- if (!E)
1292- return std::make_pair (FileID (), 0 );
1293-
1294- unsigned Offset = Loc.getOffset ()-E->getOffset ();
1295- if (Loc.isFileID ())
1296- return std::make_pair (FID, Offset);
1297-
1298- return getDecomposedExpansionLocSlowCase (E);
1287+ return getDecomposedLoc (getExpansionLoc (Loc));
12991288 }
13001289
13011290 // / Decompose the specified location into a raw FileID + Offset pair.
13021291 // /
13031292 // / If the location is an expansion record, walk through it until we find
13041293 // / its spelling record.
13051294 FileIDAndOffset getDecomposedSpellingLoc (SourceLocation Loc) const {
1306- FileID FID = getFileID (Loc);
1307- auto *E = getSLocEntryOrNull (FID);
1308- if (!E)
1309- return std::make_pair (FileID (), 0 );
1310-
1311- unsigned Offset = Loc.getOffset ()-E->getOffset ();
1312- if (Loc.isFileID ())
1313- return std::make_pair (FID, Offset);
1314- return getDecomposedSpellingLocSlowCase (E, Offset);
1295+ return getDecomposedLoc (getSpellingLoc (Loc));
13151296 }
13161297
13171298 // / Returns the "included/expanded in" decomposed location of the given
@@ -1979,10 +1960,6 @@ class SourceManager : public RefCountedBase<SourceManager> {
19791960 SourceLocation getSpellingLocSlowCase (SourceLocation Loc) const ;
19801961 SourceLocation getFileLocSlowCase (SourceLocation Loc) const ;
19811962
1982- FileIDAndOffset
1983- getDecomposedExpansionLocSlowCase (const SrcMgr::SLocEntry *E) const ;
1984- FileIDAndOffset getDecomposedSpellingLocSlowCase (const SrcMgr::SLocEntry *E,
1985- unsigned Offset) const ;
19861963 void computeMacroArgsCache (MacroArgsMap &MacroArgsCache, FileID FID) const ;
19871964 void associateFileChunkWithMacroArgExp (MacroArgsMap &MacroArgsCache,
19881965 FileID FID,
0 commit comments