aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2013-03-08 22:47:41 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2013-03-08 22:47:41 +0000
commit6f09c3d69f6272b101ff795562dffead1c0bd9de (patch)
treec909103105253c93003dd7a54a35dd8d4127204d /tools
parente4743be8984f9544878aee88b435f6381590878d (diff)
[libclang] Change clang_findReferencesInFile and clang_findIncludesInFile to return an enum,
as suggested by Jordan. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176732 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r--tools/libclang/CIndexHigh.cpp50
1 files changed, 25 insertions, 25 deletions
diff --git a/tools/libclang/CIndexHigh.cpp b/tools/libclang/CIndexHigh.cpp
index 0457a32680..2a55af57fc 100644
--- a/tools/libclang/CIndexHigh.cpp
+++ b/tools/libclang/CIndexHigh.cpp
@@ -409,29 +409,29 @@ static bool findIncludesInFile(CXTranslationUnit TU, const FileEntry *File,
extern "C" {
-int clang_findReferencesInFile(CXCursor cursor, CXFile file,
- CXCursorAndRangeVisitor visitor) {
+CXResult clang_findReferencesInFile(CXCursor cursor, CXFile file,
+ CXCursorAndRangeVisitor visitor) {
LogRef Log = Logger::make(LLVM_FUNCTION_NAME);
if (clang_Cursor_isNull(cursor)) {
if (Log)
*Log << "Null cursor";
- return 1;
+ return CXResult_Invalid;
}
if (cursor.kind == CXCursor_NoDeclFound) {
if (Log)
*Log << "Got CXCursor_NoDeclFound";
- return 1;
+ return CXResult_Invalid;
}
if (!file) {
if (Log)
*Log << "Null file";
- return 1;
+ return CXResult_Invalid;
}
if (!visitor.visit) {
if (Log)
*Log << "Null visitor";
- return 1;
+ return CXResult_Invalid;
}
if (Log)
@@ -439,7 +439,7 @@ int clang_findReferencesInFile(CXCursor cursor, CXFile file,
ASTUnit *CXXUnit = cxcursor::getCursorASTUnit(cursor);
if (!CXXUnit)
- return 1;
+ return CXResult_Invalid;
ASTUnit::ConcurrencyCheck Check(*CXXUnit);
@@ -449,8 +449,8 @@ int clang_findReferencesInFile(CXCursor cursor, CXFile file,
cursor,
static_cast<const FileEntry *>(file),
visitor))
- return -1; // visitation break;
- return 0;
+ return CXResult_VisitBreak;
+ return CXResult_Success;
}
// We are interested in semantics of identifiers so for C++ constructor exprs
@@ -467,35 +467,35 @@ int clang_findReferencesInFile(CXCursor cursor, CXFile file,
if (!clang_isDeclaration(refCursor.kind)) {
if (Log)
*Log << "cursor is not referencing a declaration";
- return 1;
+ return CXResult_Invalid;
}
if (findIdRefsInFile(cxcursor::getCursorTU(cursor),
refCursor,
static_cast<const FileEntry *>(file),
visitor))
- return -1; //visitation break;
- return 0;
+ return CXResult_VisitBreak;
+ return CXResult_Success;
}
-int clang_findIncludesInFile(CXTranslationUnit TU, CXFile file,
+CXResult clang_findIncludesInFile(CXTranslationUnit TU, CXFile file,
CXCursorAndRangeVisitor visitor) {
LogRef Log = Logger::make(LLVM_FUNCTION_NAME);
if (!TU) {
if (Log)
*Log << "Null CXTranslationUnit";
- return 1;
+ return CXResult_Invalid;
}
if (!file) {
if (Log)
*Log << "Null file";
- return 1;
+ return CXResult_Invalid;
}
if (!visitor.visit) {
if (Log)
*Log << "Null visitor";
- return 1;
+ return CXResult_Invalid;
}
if (Log)
@@ -503,13 +503,13 @@ int clang_findIncludesInFile(CXTranslationUnit TU, CXFile file,
ASTUnit *CXXUnit = cxtu::getASTUnit(TU);
if (!CXXUnit)
- return 1;
+ return CXResult_Invalid;
ASTUnit::ConcurrencyCheck Check(*CXXUnit);
if (findIncludesInFile(TU, static_cast<const FileEntry *>(file), visitor))
- return -1; //visitation break;
- return 0;
+ return CXResult_VisitBreak;
+ return CXResult_Success;
}
static enum CXVisitorResult _visitCursorAndRange(void *context,
@@ -519,17 +519,17 @@ static enum CXVisitorResult _visitCursorAndRange(void *context,
return INVOKE_BLOCK2(block, cursor, range);
}
-int clang_findReferencesInFileWithBlock(CXCursor cursor,
- CXFile file,
- CXCursorAndRangeVisitorBlock block) {
+CXResult clang_findReferencesInFileWithBlock(CXCursor cursor,
+ CXFile file,
+ CXCursorAndRangeVisitorBlock block) {
CXCursorAndRangeVisitor visitor = { block,
block ? _visitCursorAndRange : 0 };
return clang_findReferencesInFile(cursor, file, visitor);
}
-int clang_findIncludesInFileWithBlock(CXTranslationUnit TU,
- CXFile file,
- CXCursorAndRangeVisitorBlock block) {
+CXResult clang_findIncludesInFileWithBlock(CXTranslationUnit TU,
+ CXFile file,
+ CXCursorAndRangeVisitorBlock block) {
CXCursorAndRangeVisitor visitor = { block,
block ? _visitCursorAndRange : 0 };
return clang_findIncludesInFile(TU, file, visitor);