diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2014-08-26 20:23:26 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2014-08-26 20:23:26 +0000 |
commit | a2a1e53085eb33b2c32728d9b5ebbfb718d95575 (patch) | |
tree | 67bec4f13bc1b08969caa862090f61273ca75146 /clang/tools | |
parent | 96fd0a48ec8d315f8418352a62f0ee288856c4c1 (diff) | |
download | bcm5719-llvm-a2a1e53085eb33b2c32728d9b5ebbfb718d95575.tar.gz bcm5719-llvm-a2a1e53085eb33b2c32728d9b5ebbfb718d95575.zip |
[libclang] Fixup the cursor spelling range for C++ destructors, operator overloads, and conversion functions.
Patch by Craig Tenenbaum!
llvm-svn: 216480
Diffstat (limited to 'clang/tools')
-rw-r--r-- | clang/tools/libclang/CIndex.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp index 83fd6c6ba60..6689ac2a8cf 100644 --- a/clang/tools/libclang/CIndex.cpp +++ b/clang/tools/libclang/CIndex.cpp @@ -3669,6 +3669,18 @@ CXSourceRange clang_Cursor_getSpellingNameRange(CXCursor C, return clang_getNullRange(); } + if (C.kind == CXCursor_CXXMethod || C.kind == CXCursor_Destructor || + C.kind == CXCursor_ConversionFunction) { + if (pieceIndex > 0) + return clang_getNullRange(); + if (const FunctionDecl *FD = + dyn_cast_or_null<FunctionDecl>(getCursorDecl(C))) { + DeclarationNameInfo FunctionName = FD->getNameInfo(); + return cxloc::translateSourceRange(Ctx, FunctionName.getSourceRange()); + } + return clang_getNullRange(); + } + // FIXME: A CXCursor_InclusionDirective should give the location of the // filename, but we don't keep track of this. |