Add libclang function 'clang_isFromMainFile()' (which just wraps SourceManager::isFromMainFile()).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104208 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp
index 945d05b..d077356 100644
--- a/tools/libclang/CIndex.cpp
+++ b/tools/libclang/CIndex.cpp
@@ -1479,6 +1479,13 @@
   return Result;
 }
 
+unsigned clang_isFromMainFile(CXSourceLocation loc) {
+  SourceLocation Loc = SourceLocation::getFromRawEncoding(loc.int_data);
+  const SourceManager &SM =
+    *static_cast<const SourceManager*>(loc.ptr_data[0]);
+  return SM.isFromMainFile(Loc) ? 1 : 0;
+}
+
 } // end: extern "C"
 
 //===----------------------------------------------------------------------===//