diff options
| author | Ted Kremenek <kremenek@apple.com> | 2010-01-15 20:35:54 +0000 |
|---|---|---|
| committer | Ted Kremenek <kremenek@apple.com> | 2010-01-15 20:35:54 +0000 |
| commit | 87553c42c09b6f494ed909fae3bd8de9ff65bdf8 (patch) | |
| tree | cd18dc756390f87c1e1e97f3ec9db948175d3e8c | |
| parent | cab014721bcd634cec89761255ca2e9c821f6a15 (diff) | |
| download | bcm5719-llvm-87553c42c09b6f494ed909fae3bd8de9ff65bdf8.tar.gz bcm5719-llvm-87553c42c09b6f494ed909fae3bd8de9ff65bdf8.zip | |
Add CXCursor.[h,cpp]. These files will centralize the logic for creating/probing CXCursors.
llvm-svn: 93547
| -rw-r--r-- | clang/tools/CIndex/CIndex.cpp | 14 | ||||
| -rw-r--r-- | clang/tools/CIndex/CMakeLists.txt | 1 | ||||
| -rw-r--r-- | clang/tools/CIndex/CXCursor.cpp | 29 | ||||
| -rw-r--r-- | clang/tools/CIndex/CXCursor.h | 31 |
4 files changed, 63 insertions, 12 deletions
diff --git a/clang/tools/CIndex/CIndex.cpp b/clang/tools/CIndex/CIndex.cpp index f24a7425936..c1f05a8bc03 100644 --- a/clang/tools/CIndex/CIndex.cpp +++ b/clang/tools/CIndex/CIndex.cpp @@ -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 @@ static enum CXCursorKind TranslateKind(Decl *D) { 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(); diff --git a/clang/tools/CIndex/CMakeLists.txt b/clang/tools/CIndex/CMakeLists.txt index 52f847ef17d..c667df622f7 100644 --- a/clang/tools/CIndex/CMakeLists.txt +++ b/clang/tools/CIndex/CMakeLists.txt @@ -24,6 +24,7 @@ add_clang_library(CIndex CIndexCodeCompletion.cpp CIndexUSRs.cpp CIndexer.cpp + CXCursor.cpp ) if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") diff --git a/clang/tools/CIndex/CXCursor.cpp b/clang/tools/CIndex/CXCursor.cpp new file mode 100644 index 00000000000..a7a7dfca65e --- /dev/null +++ b/clang/tools/CIndex/CXCursor.cpp @@ -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; +} + diff --git a/clang/tools/CIndex/CXCursor.h b/clang/tools/CIndex/CXCursor.h new file mode 100644 index 00000000000..f1829f45eaa --- /dev/null +++ b/clang/tools/CIndex/CXCursor.h @@ -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 |

