diff options
author | Dmitri Gribenko <gribozavr@gmail.com> | 2013-01-23 17:25:27 +0000 |
---|---|---|
committer | Dmitri Gribenko <gribozavr@gmail.com> | 2013-01-23 17:25:27 +0000 |
commit | e22339c44bb28d71a2cc97c840d3da0c4bdb4909 (patch) | |
tree | 5288e46873098b5ae526f3ef53957c4ec5528d2c /tools/libclang/CIndexCXX.cpp | |
parent | 89cf425f1136f8d24a64ed94450e488b6794dfa4 (diff) |
libclang: change return type of getCursorDecl() to 'const Decl *'
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173278 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/libclang/CIndexCXX.cpp')
-rw-r--r-- | tools/libclang/CIndexCXX.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/tools/libclang/CIndexCXX.cpp b/tools/libclang/CIndexCXX.cpp index d069d41de2..c68dde7c2c 100644 --- a/tools/libclang/CIndexCXX.cpp +++ b/tools/libclang/CIndexCXX.cpp @@ -56,13 +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(), getCursorTU(C)).kind; break; case CXCursor_ClassTemplatePartialSpecialization: - if (ClassTemplateSpecializationDecl *PartialSpec + if (const ClassTemplateSpecializationDecl *PartialSpec = dyn_cast_or_null<ClassTemplatePartialSpecializationDecl>( getCursorDecl(C))) { switch (PartialSpec->getTagKind()) { @@ -86,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 @@ -107,14 +107,14 @@ 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(); |