summaryrefslogtreecommitdiffstats
path: root/tools/libclang/CIndexCXX.cpp
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2013-04-08 18:45:10 +0000
committerdim <dim@FreeBSD.org>2013-04-08 18:45:10 +0000
commitc72c57c9e9b69944e3e009cd5e209634839581d3 (patch)
tree4fc2f184c499d106f29a386c452b49e5197bf63d /tools/libclang/CIndexCXX.cpp
parent5b20025c30d23d521e12c1f33ec8fa6b821952cd (diff)
downloadFreeBSD-src-c72c57c9e9b69944e3e009cd5e209634839581d3.zip
FreeBSD-src-c72c57c9e9b69944e3e009cd5e209634839581d3.tar.gz
Vendor import of clang trunk r178860:
http://llvm.org/svn/llvm-project/cfe/trunk@178860
Diffstat (limited to 'tools/libclang/CIndexCXX.cpp')
-rw-r--r--tools/libclang/CIndexCXX.cpp25
1 files changed, 12 insertions, 13 deletions
diff --git a/tools/libclang/CIndexCXX.cpp b/tools/libclang/CIndexCXX.cpp
index 9bc3efa..c68dde7 100644
--- a/tools/libclang/CIndexCXX.cpp
+++ b/tools/libclang/CIndexCXX.cpp
@@ -26,7 +26,7 @@ unsigned clang_isVirtualBase(CXCursor C) {
if (C.kind != CXCursor_CXXBaseSpecifier)
return 0;
- CXXBaseSpecifier *B = getCursorCXXBaseSpecifier(C);
+ const CXXBaseSpecifier *B = getCursorCXXBaseSpecifier(C);
return B->isVirtual();
}
@@ -56,14 +56,13 @@ enum CXCursorKind clang_getTemplateCursorKind(CXCursor C) {
switch (C.kind) {
case CXCursor_ClassTemplate:
case CXCursor_FunctionTemplate:
- if (TemplateDecl *Template
+ if (const TemplateDecl *Template
= dyn_cast_or_null<TemplateDecl>(getCursorDecl(C)))
- return MakeCXCursor(Template->getTemplatedDecl(),
- static_cast<CXTranslationUnit>(C.data[2])).kind;
+ return MakeCXCursor(Template->getTemplatedDecl(), getCursorTU(C)).kind;
break;
case CXCursor_ClassTemplatePartialSpecialization:
- if (ClassTemplateSpecializationDecl *PartialSpec
+ if (const ClassTemplateSpecializationDecl *PartialSpec
= dyn_cast_or_null<ClassTemplatePartialSpecializationDecl>(
getCursorDecl(C))) {
switch (PartialSpec->getTagKind()) {
@@ -87,16 +86,16 @@ CXCursor clang_getSpecializedCursorTemplate(CXCursor C) {
if (!clang_isDeclaration(C.kind))
return clang_getNullCursor();
- Decl *D = getCursorDecl(C);
+ const Decl *D = getCursorDecl(C);
if (!D)
return clang_getNullCursor();
Decl *Template = 0;
- if (CXXRecordDecl *CXXRecord = dyn_cast<CXXRecordDecl>(D)) {
- if (ClassTemplatePartialSpecializationDecl *PartialSpec
+ if (const CXXRecordDecl *CXXRecord = dyn_cast<CXXRecordDecl>(D)) {
+ if (const ClassTemplatePartialSpecializationDecl *PartialSpec
= dyn_cast<ClassTemplatePartialSpecializationDecl>(CXXRecord))
Template = PartialSpec->getSpecializedTemplate();
- else if (ClassTemplateSpecializationDecl *ClassSpec
+ else if (const ClassTemplateSpecializationDecl *ClassSpec
= dyn_cast<ClassTemplateSpecializationDecl>(CXXRecord)) {
llvm::PointerUnion<ClassTemplateDecl *,
ClassTemplatePartialSpecializationDecl *> Result
@@ -108,21 +107,21 @@ CXCursor clang_getSpecializedCursorTemplate(CXCursor C) {
} else
Template = CXXRecord->getInstantiatedFromMemberClass();
- } else if (FunctionDecl *Function = dyn_cast<FunctionDecl>(D)) {
+ } else if (const FunctionDecl *Function = dyn_cast<FunctionDecl>(D)) {
Template = Function->getPrimaryTemplate();
if (!Template)
Template = Function->getInstantiatedFromMemberFunction();
- } else if (VarDecl *Var = dyn_cast<VarDecl>(D)) {
+ } else if (const VarDecl *Var = dyn_cast<VarDecl>(D)) {
if (Var->isStaticDataMember())
Template = Var->getInstantiatedFromStaticDataMember();
- } else if (RedeclarableTemplateDecl *Tmpl
+ } else if (const RedeclarableTemplateDecl *Tmpl
= dyn_cast<RedeclarableTemplateDecl>(D))
Template = Tmpl->getInstantiatedFromMemberTemplate();
if (!Template)
return clang_getNullCursor();
- return MakeCXCursor(Template, static_cast<CXTranslationUnit>(C.data[2]));
+ return MakeCXCursor(Template, getCursorTU(C));
}
} // end extern "C"
OpenPOWER on IntegriCloud