[cfe-commits] r93547 - in /cfe/trunk/tools/CIndex: CIndex.cpp CMakeLists.txt CXCursor.cpp CXCursor.h

Ted Kremenek kremenek at apple.com
Fri Jan 15 12:35:54 PST 2010


Author: kremenek
Date: Fri Jan 15 14:35:54 2010
New Revision: 93547

URL: http://llvm.org/viewvc/llvm-project?rev=93547&view=rev
Log:
Add CXCursor.[h,cpp].  These files will centralize the logic for creating/probing CXCursors.

Added:
    cfe/trunk/tools/CIndex/CXCursor.cpp
    cfe/trunk/tools/CIndex/CXCursor.h
Modified:
    cfe/trunk/tools/CIndex/CIndex.cpp
    cfe/trunk/tools/CIndex/CMakeLists.txt

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

==============================================================================
--- cfe/trunk/tools/CIndex/CIndex.cpp (original)
+++ cfe/trunk/tools/CIndex/CIndex.cpp Fri Jan 15 14:35:54 2010
@@ -13,6 +13,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "CIndexer.h"
+#include "CXCursor.h"
 
 #include "clang/AST/DeclVisitor.h"
 #include "clang/AST/StmtVisitor.h"
@@ -24,6 +25,7 @@
 #include <cstdio>
 
 using namespace clang;
+using namespace clang::cxcursor;
 using namespace idx;
 
 //===----------------------------------------------------------------------===//
@@ -846,18 +848,6 @@
   return CXCursor_NotImplemented;
 }
 
-
-static CXCursor MakeCXCursor(CXCursorKind K, Decl *D) {
-  CXCursor C = { K, D, 0, 0 };
-  return C;  
-}
-
-static CXCursor MakeCXCursor(CXCursorKind K, Decl *D, Stmt *S) {
-  assert(clang_isReference(K));
-  CXCursor C = { K, D, S, 0 };
-  return C;  
-}
-
 static Decl *getDeclFromExpr(Stmt *E) {
   if (DeclRefExpr *RefExpr = dyn_cast<DeclRefExpr>(E))
     return RefExpr->getDecl();

Modified: cfe/trunk/tools/CIndex/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/CIndex/CMakeLists.txt?rev=93547&r1=93546&r2=93547&view=diff

==============================================================================
--- cfe/trunk/tools/CIndex/CMakeLists.txt (original)
+++ cfe/trunk/tools/CIndex/CMakeLists.txt Fri Jan 15 14:35:54 2010
@@ -24,6 +24,7 @@
   CIndexCodeCompletion.cpp
   CIndexUSRs.cpp
   CIndexer.cpp
+  CXCursor.cpp
 )
 
 if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")

Added: cfe/trunk/tools/CIndex/CXCursor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/CIndex/CXCursor.cpp?rev=93547&view=auto

==============================================================================
--- cfe/trunk/tools/CIndex/CXCursor.cpp (added)
+++ cfe/trunk/tools/CIndex/CXCursor.cpp Fri Jan 15 14:35:54 2010
@@ -0,0 +1,29 @@
+//===- CXCursor.cpp - Routines for manipulating CXCursors -----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file defines routines for manipulating CXCursors.
+//
+//===----------------------------------------------------------------------===//
+
+#include "CXCursor.h"
+#include "clang/AST/Decl.h"
+
+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) {
+  assert(clang_isReference(K));
+  CXCursor C = { K, D, S, 0 };
+  return C;  
+}
+

Added: cfe/trunk/tools/CIndex/CXCursor.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/CIndex/CXCursor.h?rev=93547&view=auto

==============================================================================
--- cfe/trunk/tools/CIndex/CXCursor.h (added)
+++ cfe/trunk/tools/CIndex/CXCursor.h Fri Jan 15 14:35:54 2010
@@ -0,0 +1,31 @@
+//===- CXCursor.h - Routines for manipulating CXCursors -------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file defines routines for manipulating CXCursors.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_CLANG_CXCURSOR_H
+#define LLVM_CLANG_CXCursor_H
+
+#include "clang-c/Index.h"
+
+namespace clang {
+
+class Decl;
+class Stmt;
+
+namespace cxcursor {
+  
+CXCursor MakeCXCursor(CXCursorKind K, clang::Decl *D);  
+CXCursor MakeCXCursor(CXCursorKind K, clang::Decl *D, clang::Stmt *S);
+
+}} // end namespace: clang::cxcursor
+
+#endif





More information about the cfe-commits mailing list