forked from OSchip/llvm-project
Add libclang function 'clang_isFromMainFile()' (which just wraps SourceManager::isFromMainFile()).
llvm-svn: 104208
This commit is contained in:
parent
fe60c14263
commit
76a434840a
|
@ -342,6 +342,12 @@ CINDEX_LINKAGE CXSourceLocation clang_getRangeStart(CXSourceRange range);
|
|||
*/
|
||||
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);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
|
|
@ -1479,6 +1479,13 @@ CXSourceLocation clang_getRangeEnd(CXSourceRange range) {
|
|||
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"
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
|
|
@ -77,6 +77,7 @@ _clang_getTypeKindSpelling
|
|||
_clang_isCursorDefinition
|
||||
_clang_isDeclaration
|
||||
_clang_isExpression
|
||||
_clang_isFromMainFile
|
||||
_clang_isInvalid
|
||||
_clang_isPreprocessing
|
||||
_clang_isReference
|
||||
|
|
|
@ -77,6 +77,7 @@ clang_getTypeKindSpelling
|
|||
clang_isCursorDefinition
|
||||
clang_isDeclaration
|
||||
clang_isExpression
|
||||
clang_isFromMainFile
|
||||
clang_isInvalid
|
||||
clang_isPreprocessing
|
||||
clang_isReference
|
||||
|
|
Loading…
Reference in New Issue