[cfe-commits] r94049 - in /cfe/trunk/tools/CIndex: CIndex.cpp CXCursor.cpp CXCursor.h

Douglas Gregor dgregor at apple.com
Wed Jan 20 15:34:41 PST 2010


Author: dgregor
Date: Wed Jan 20 17:34:41 2010
New Revision: 94049

URL: http://llvm.org/viewvc/llvm-project?rev=94049&view=rev
Log:
Eliminate the MakeCXCursor routines that require their callers to know too much about the cursor's storage

Modified:
    cfe/trunk/tools/CIndex/CIndex.cpp
    cfe/trunk/tools/CIndex/CXCursor.cpp
    cfe/trunk/tools/CIndex/CXCursor.h

Modified: cfe/trunk/tools/CIndex/CIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/CIndex/CIndex.cpp?rev=94049&r1=94048&r2=94049&view=diff

==============================================================================
--- cfe/trunk/tools/CIndex/CIndex.cpp (original)
+++ cfe/trunk/tools/CIndex/CIndex.cpp Wed Jan 20 17:34:41 2010
@@ -797,11 +797,11 @@
     }
     return MakeCXCursor(Dcl);
   }
-  return MakeCXCursor(CXCursor_NoDeclFound, 0);
+  return MakeCXCursorInvalid(CXCursor_NoDeclFound);
 }
 
 CXCursor clang_getNullCursor(void) {
-  return MakeCXCursor(CXCursor_InvalidFile, 0);
+  return MakeCXCursorInvalid(CXCursor_InvalidFile);
 }
 
 unsigned clang_equalCursors(CXCursor X, CXCursor Y) {

Modified: cfe/trunk/tools/CIndex/CXCursor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/CIndex/CXCursor.cpp?rev=94049&r1=94048&r2=94049&view=diff

==============================================================================
--- cfe/trunk/tools/CIndex/CXCursor.cpp (original)
+++ cfe/trunk/tools/CIndex/CXCursor.cpp Wed Jan 20 17:34:41 2010
@@ -22,16 +22,10 @@
 
 using namespace clang;
 
-CXCursor cxcursor::MakeCXCursor(CXCursorKind K, Decl *D) {
-  CXCursor C = { K, { D, 0, 0 } };
-  return C;  
-}
-
-CXCursor cxcursor::MakeCXCursor(CXCursorKind K, Decl *D, Stmt *S,
-                                ASTContext &Context) {
-  assert(clang_isReference(K));
-  CXCursor C = { K, { D, S, &Context } };
-  return C;  
+CXCursor cxcursor::MakeCXCursorInvalid(CXCursorKind K) {
+  assert(K >= CXCursor_FirstInvalid && K <= CXCursor_LastInvalid);
+  CXCursor C = { K, { 0, 0, 0 } };
+  return C;
 }
 
 static CXCursorKind GetCursorKind(Decl *D) {
@@ -78,7 +72,8 @@
 }
 
 CXCursor cxcursor::MakeCXCursor(Decl *D) {
-  return MakeCXCursor(GetCursorKind(D), D);
+  CXCursor C = { GetCursorKind(D), { D, 0, 0 } };
+  return C;
 }
 
 CXCursor cxcursor::MakeCXCursor(Stmt *S, Decl *Parent) {

Modified: cfe/trunk/tools/CIndex/CXCursor.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/CIndex/CXCursor.h?rev=94049&r1=94048&r2=94049&view=diff

==============================================================================
--- cfe/trunk/tools/CIndex/CXCursor.h (original)
+++ cfe/trunk/tools/CIndex/CXCursor.h Wed Jan 20 17:34:41 2010
@@ -30,9 +30,7 @@
 
 namespace cxcursor {
   
-CXCursor MakeCXCursor(CXCursorKind K, clang::Decl *D);  
-CXCursor MakeCXCursor(CXCursorKind K, clang::Decl *D, clang::Stmt *S,
-                      ASTContext &Context);
+CXCursor MakeCXCursorInvalid(CXCursorKind K);
 CXCursor MakeCXCursor(clang::Stmt *S, clang::Decl *Parent);
 CXCursor MakeCXCursor(clang::Decl *D);
 





More information about the cfe-commits mailing list