@@ -1114,13 +1114,7 @@ class SourceManager : public RefCountedBase<SourceManager> {
1114
1114
// / the entry in SLocEntryTable which contains the specified location.
1115
1115
// /
1116
1116
FileID getFileID (SourceLocation SpellingLoc) const {
1117
- SourceLocation::UIntTy SLocOffset = SpellingLoc.getOffset ();
1118
-
1119
- // If our one-entry cache covers this offset, just return it.
1120
- if (isOffsetInFileID (LastFileIDLookup, SLocOffset))
1121
- return LastFileIDLookup;
1122
-
1123
- return getFileIDSlow (SLocOffset);
1117
+ return getFileID (SpellingLoc.getOffset ());
1124
1118
}
1125
1119
1126
1120
// / Return the filename of the file containing a SourceLocation.
@@ -1747,12 +1741,12 @@ class SourceManager : public RefCountedBase<SourceManager> {
1747
1741
1748
1742
// / Returns true if \p Loc came from a PCH/Module.
1749
1743
bool isLoadedSourceLocation (SourceLocation Loc) const {
1750
- return Loc.getOffset () >= CurrentLoadedOffset ;
1744
+ return isLoadedOffset ( Loc.getOffset ()) ;
1751
1745
}
1752
1746
1753
1747
// / Returns true if \p Loc did not come from a PCH/Module.
1754
1748
bool isLocalSourceLocation (SourceLocation Loc) const {
1755
- return Loc.getOffset () < NextLocalOffset ;
1749
+ return isLocalOffset ( Loc.getOffset ()) ;
1756
1750
}
1757
1751
1758
1752
// / Returns true if \p FID came from a PCH/Module.
@@ -1822,6 +1816,22 @@ class SourceManager : public RefCountedBase<SourceManager> {
1822
1816
return getLoadedSLocEntry (static_cast <unsigned >(-ID - 2 ), Invalid);
1823
1817
}
1824
1818
1819
+ FileID getFileID (SourceLocation::UIntTy SLocOffset) const {
1820
+ // If our one-entry cache covers this offset, just return it.
1821
+ if (isOffsetInFileID (LastFileIDLookup, SLocOffset))
1822
+ return LastFileIDLookup;
1823
+
1824
+ return getFileIDSlow (SLocOffset);
1825
+ }
1826
+
1827
+ bool isLocalOffset (SourceLocation::UIntTy SLocOffset) const {
1828
+ return SLocOffset < CurrentLoadedOffset;
1829
+ }
1830
+
1831
+ bool isLoadedOffset (SourceLocation::UIntTy SLocOffset) const {
1832
+ return SLocOffset >= CurrentLoadedOffset;
1833
+ }
1834
+
1825
1835
// / Implements the common elements of storing an expansion info struct into
1826
1836
// / the SLocEntry table and producing a source location that refers to it.
1827
1837
SourceLocation
0 commit comments