[cfe-commits] r143339 - /cfe/trunk/include/clang/Basic/SourceManager.h

Argyrios Kyrtzidis akyrtzi at gmail.com
Mon Oct 31 00:20:04 PDT 2011


Author: akirtzidis
Date: Mon Oct 31 02:20:03 2011
New Revision: 143339

URL: http://llvm.org/viewvc/llvm-project?rev=143339&view=rev
Log:
Introduce SourceManager::isLocalFileID/isLoadedFileID functions.

Modified:
    cfe/trunk/include/clang/Basic/SourceManager.h

Modified: cfe/trunk/include/clang/Basic/SourceManager.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/SourceManager.h?rev=143339&r1=143338&r2=143339&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/SourceManager.h (original)
+++ cfe/trunk/include/clang/Basic/SourceManager.h Mon Oct 31 02:20:03 2011
@@ -1260,6 +1260,17 @@
     return Loc.getOffset() < NextLocalOffset;
   }
 
+  /// \brief Returns true if \arg FID came from a PCH/Module.
+  bool isLoadedFileID(FileID FID) const {
+    assert(FID.ID != -1 && "Using FileID sentinel value");
+    return FID.ID < 0;
+  }
+
+  /// \brief Returns true if \arg FID did not come from a PCH/Module.
+  bool isLocalFileID(FileID FID) const {
+    return !isLoadedFileID(FID);
+  }
+
 private:
   const llvm::MemoryBuffer *getFakeBufferForRecovery() const;
 





More information about the cfe-commits mailing list