*/
CINDEX_LINKAGE CXSourceLocation clang_getRangeEnd(CXSourceRange range);
+/**
+ * \brief Determine if the source location occurs within the main file
+ * of the translation unit (as opposed to an included header).
+ */
+CINDEX_LINKAGE unsigned clang_isFromMainFile(CXSourceLocation loc);
+
/**
* @}
*/
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"
//===----------------------------------------------------------------------===//
_clang_isCursorDefinition
_clang_isDeclaration
_clang_isExpression
+_clang_isFromMainFile
_clang_isInvalid
_clang_isPreprocessing
_clang_isReference
clang_isCursorDefinition
clang_isDeclaration
clang_isExpression
+clang_isFromMainFile
clang_isInvalid
clang_isPreprocessing
clang_isReference