]> granicus.if.org Git - clang/commitdiff
Introduce isLoadedSourceLocation() and isLocalSourceLocation() methods in SourceManager.
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Mon, 19 Sep 2011 20:40:05 +0000 (20:40 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Mon, 19 Sep 2011 20:40:05 +0000 (20:40 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140055 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/SourceManager.h

index 9dc19458521cf01c9806c22f5bc2a1508c721993..2bd07c6d5f519dfaac1ccfce8b350bcd37192bea 100644 (file)
@@ -1223,6 +1223,16 @@ public:
   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;