From aa6edaeb35e02a07bd4840c0159900754f083ce5 Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Mon, 19 Sep 2011 20:40:05 +0000 Subject: [PATCH] Introduce isLoadedSourceLocation() and isLocalSourceLocation() methods in SourceManager. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140055 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Basic/SourceManager.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/clang/Basic/SourceManager.h b/include/clang/Basic/SourceManager.h index 9dc1945852..2bd07c6d5f 100644 --- a/include/clang/Basic/SourceManager.h +++ b/include/clang/Basic/SourceManager.h @@ -1223,6 +1223,16 @@ public: std::pair 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; -- 2.40.0