diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2013-04-18 16:41:15 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2013-04-18 16:41:15 +0000 |
commit | 7717914639ed8a186fe8b781c9c220594e8dcf30 (patch) | |
tree | 8626cbf6cb716112104b2eee838d61dd93b9175e /tools | |
parent | 258277d5a922e06ef523f7805900689b680ddc7d (diff) |
[libclang] Report parameter array types as written in source, not decayed to pointer types.
Patch by Doug.
rdar://13684618
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179769 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r-- | tools/libclang/CXType.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/tools/libclang/CXType.cpp b/tools/libclang/CXType.cpp index 16009bf47a..148241597a 100644 --- a/tools/libclang/CXType.cpp +++ b/tools/libclang/CXType.cpp @@ -149,14 +149,20 @@ CXType clang_getCursorType(CXCursor C) { return MakeCXType(Context.getTypeDeclType(TD), TU); if (const ObjCInterfaceDecl *ID = dyn_cast<ObjCInterfaceDecl>(D)) return MakeCXType(Context.getObjCInterfaceType(ID), TU); + if (const DeclaratorDecl *DD = dyn_cast<DeclaratorDecl>(D)) { + if (TypeSourceInfo *TSInfo = DD->getTypeSourceInfo()) + return MakeCXType(TSInfo->getType(), TU); + return MakeCXType(DD->getType(), TU); + } if (const ValueDecl *VD = dyn_cast<ValueDecl>(D)) return MakeCXType(VD->getType(), TU); if (const ObjCPropertyDecl *PD = dyn_cast<ObjCPropertyDecl>(D)) return MakeCXType(PD->getType(), TU); - if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) - return MakeCXType(FD->getType(), TU); - if (const FunctionTemplateDecl *FTD = dyn_cast<FunctionTemplateDecl>(D)) + if (const FunctionTemplateDecl *FTD = dyn_cast<FunctionTemplateDecl>(D)) { + if (TypeSourceInfo *TSInfo = FTD->getTemplatedDecl()->getTypeSourceInfo()) + return MakeCXType(TSInfo->getType(), TU); return MakeCXType(FTD->getTemplatedDecl()->getType(), TU); + } return MakeCXType(QualType(), TU); } |