summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-08-31 17:01:39 +0000
committerDouglas Gregor <dgregor@apple.com>2010-08-31 17:01:39 +0000
commitfe72e9ceeae6cc8669cd8bb722425300190638ea (patch)
treea0807deac8023b9fa4a307a32186344289034890 /include
parentf13721dd91dda7675e499331a2770308ad20ca61 (diff)
Implement basic support for indexing function templates in
libclang. This includes: - Cursor kind for function templates, with visitation logic - Cursor kinds for template parameters, with visitation logic - Visitation logic for template specialization types, qualified type locations - USR generation for function templates, template specialization types, template parameter types. Also happens to fix PR7804, which I tripped across while testing. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112604 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/clang-c/Index.h10
-rw-r--r--include/clang/AST/DeclTemplate.h7
2 files changed, 16 insertions, 1 deletions
diff --git a/include/clang-c/Index.h b/include/clang-c/Index.h
index e3d10f3fcd..cc00f1835b 100644
--- a/include/clang-c/Index.h
+++ b/include/clang-c/Index.h
@@ -982,8 +982,16 @@ enum CXCursorKind {
CXCursor_Destructor = 25,
/** \brief A C++ conversion function. */
CXCursor_ConversionFunction = 26,
+ /** \brief A C++ template type parameter. */
+ CXCursor_TemplateTypeParameter = 27,
+ /** \brief A C++ non-type template parameter. */
+ CXCursor_NonTypeTemplateParameter = 28,
+ /** \brief A C++ template template parameter. */
+ CXCursor_TemplateTemplateParameter = 29,
+ /** \brief A C++ function template. */
+ CXCursor_FunctionTemplate = 30,
CXCursor_FirstDecl = CXCursor_UnexposedDecl,
- CXCursor_LastDecl = CXCursor_ConversionFunction,
+ CXCursor_LastDecl = CXCursor_FunctionTemplate,
/* References */
CXCursor_FirstRef = 40, /* Decl references */
diff --git a/include/clang/AST/DeclTemplate.h b/include/clang/AST/DeclTemplate.h
index 3861cd9a91..76d474a8cd 100644
--- a/include/clang/AST/DeclTemplate.h
+++ b/include/clang/AST/DeclTemplate.h
@@ -1138,6 +1138,13 @@ public:
DefaultArgumentWasInherited = false;
}
+ SourceRange getSourceRange() const {
+ SourceLocation End = getLocation();
+ if (hasDefaultArgument() && !defaultArgumentWasInherited())
+ End = getDefaultArgument().getSourceRange().getEnd();
+ return SourceRange(getTemplateParameters()->getTemplateLoc(), End);
+ }
+
// Implement isa/cast/dyncast/etc.
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
static bool classof(const TemplateTemplateParmDecl *D) { return true; }