diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-08-31 20:37:03 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-08-31 20:37:03 +0000 |
commit | a23e8f7a0f2001d5d77c2be390e39288b128c812 (patch) | |
tree | 687d82b5eeae23de2f63d26c029b8eafc4b809dd /clang/tools/libclang/CXCursor.cpp | |
parent | a5e6b3eca4dd3a12e13711d5e024326e206da5f2 (diff) | |
download | bcm5719-llvm-a23e8f7a0f2001d5d77c2be390e39288b128c812.tar.gz bcm5719-llvm-a23e8f7a0f2001d5d77c2be390e39288b128c812.zip |
Extend libclang with a new cursor kind that indicates a reference to a
template. Such cursors occur, for example, in template specialization
types such as vector<int>. Note that we do not handle the
super-interesting case where the template name is unresolved, e.g.,
within a template.
llvm-svn: 112636
Diffstat (limited to 'clang/tools/libclang/CXCursor.cpp')
-rw-r--r-- | clang/tools/libclang/CXCursor.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/clang/tools/libclang/CXCursor.cpp b/clang/tools/libclang/CXCursor.cpp index 691ccd5f327..0fa201a146c 100644 --- a/clang/tools/libclang/CXCursor.cpp +++ b/clang/tools/libclang/CXCursor.cpp @@ -313,6 +313,22 @@ cxcursor::getCursorTypeRef(CXCursor C) { reinterpret_cast<uintptr_t>(C.data[1]))); } +CXCursor cxcursor::MakeCursorTemplateRef(TemplateDecl *Template, + SourceLocation Loc, ASTUnit *TU) { + assert(Template && TU && "Invalid arguments!"); + void *RawLoc = reinterpret_cast<void *>(Loc.getRawEncoding()); + CXCursor C = { CXCursor_TemplateRef, { Template, RawLoc, TU } }; + return C; +} + +std::pair<TemplateDecl *, SourceLocation> +cxcursor::getCursorTemplateRef(CXCursor C) { + assert(C.kind == CXCursor_TemplateRef); + return std::make_pair(static_cast<TemplateDecl *>(C.data[0]), + SourceLocation::getFromRawEncoding( + reinterpret_cast<uintptr_t>(C.data[1]))); +} + CXCursor cxcursor::MakeCursorCXXBaseSpecifier(CXXBaseSpecifier *B, ASTUnit *TU){ CXCursor C = { CXCursor_CXXBaseSpecifier, { B, 0, TU } }; return C; |