forked from OSchip/llvm-project
Implement a simple hash function for libclang cursors
llvm-svn: 119876
This commit is contained in:
parent
54df187f25
commit
06a3f30be9
|
@ -1350,6 +1350,11 @@ CINDEX_LINKAGE CXCursor clang_getTranslationUnitCursor(CXTranslationUnit);
|
|||
*/
|
||||
CINDEX_LINKAGE unsigned clang_equalCursors(CXCursor, CXCursor);
|
||||
|
||||
/**
|
||||
* \brief Compute a hash value for the given cursor.
|
||||
*/
|
||||
CINDEX_LINKAGE unsigned clang_hashCursor(CXCursor);
|
||||
|
||||
/**
|
||||
* \brief Retrieve the kind of the given cursor.
|
||||
*/
|
||||
|
|
|
@ -3137,6 +3137,15 @@ unsigned clang_equalCursors(CXCursor X, CXCursor Y) {
|
|||
return X == Y;
|
||||
}
|
||||
|
||||
unsigned clang_hashCursor(CXCursor C) {
|
||||
unsigned Index = 0;
|
||||
if (clang_isExpression(C.kind) || clang_isStatement(C.kind))
|
||||
Index = 1;
|
||||
|
||||
return llvm::DenseMapInfo<std::pair<unsigned, void*> >::getHashValue(
|
||||
std::make_pair(C.kind, C.data[Index]));
|
||||
}
|
||||
|
||||
unsigned clang_isInvalid(enum CXCursorKind K) {
|
||||
return K >= CXCursor_FirstInvalid && K <= CXCursor_LastInvalid;
|
||||
}
|
||||
|
|
|
@ -102,6 +102,7 @@ _clang_getTranslationUnitCursor
|
|||
_clang_getTranslationUnitSpelling
|
||||
_clang_getTypeDeclaration
|
||||
_clang_getTypeKindSpelling
|
||||
_clang_hashCursor
|
||||
_clang_isCursorDefinition
|
||||
_clang_isDeclaration
|
||||
_clang_isExpression
|
||||
|
|
|
@ -102,6 +102,7 @@ clang_getTranslationUnitCursor
|
|||
clang_getTranslationUnitSpelling
|
||||
clang_getTypeDeclaration
|
||||
clang_getTypeKindSpelling
|
||||
clang_hashCursor
|
||||
clang_isCursorDefinition
|
||||
clang_isDeclaration
|
||||
clang_isExpression
|
||||
|
|
Loading…
Reference in New Issue