Introduce isLoadedSourceLocation() and isLocalSourceLocation() methods in SourceManager.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140055 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/clang/Basic/SourceManager.h b/include/clang/Basic/SourceManager.h
index 9dc1945..2bd07c6 100644
--- a/include/clang/Basic/SourceManager.h
+++ b/include/clang/Basic/SourceManager.h
@@ -1223,6 +1223,16 @@
std::pair<int, unsigned>
AllocateLoadedSLocEntries(unsigned NumSLocEntries, unsigned TotalSize);
+ /// \brief Returns true if \arg Loc came from a PCH/Module.
+ bool isLoadedSourceLocation(SourceLocation Loc) const {
+ return Loc.getOffset() >= CurrentLoadedOffset;
+ }
+
+ /// \brief Returns true if \arg Loc did not come from a PCH/Module.
+ bool isLocalSourceLocation(SourceLocation Loc) const {
+ return Loc.getOffset() < NextLocalOffset;
+ }
+
private:
const llvm::MemoryBuffer *getFakeBufferForRecovery() const;