diff options
| author | Douglas Gregor <dgregor@apple.com> | 2010-10-02 19:51:13 +0000 |
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2010-10-02 19:51:13 +0000 |
| commit | 3478c75b7171d235297ba3e8846093ac88f1c295 (patch) | |
| tree | 87d6fa1ff2fe6588e34f2b0f75b931f79e297587 /clang/tools/libclang | |
| parent | 97eac6755214154b62994641c5cae0c419fe3390 (diff) | |
| download | bcm5719-llvm-3478c75b7171d235297ba3e8846093ac88f1c295.tar.gz bcm5719-llvm-3478c75b7171d235297ba3e8846093ac88f1c295.zip | |
Provide proper source location and range information for C++ base
specifier cursors in libclang. FIXME -=2, fixes the rest of
<rdar://problem/8274883>.
llvm-svn: 115419
Diffstat (limited to 'clang/tools/libclang')
| -rw-r--r-- | clang/tools/libclang/CIndex.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp index 908b99d4e12..04d0bc50d60 100644 --- a/clang/tools/libclang/CIndex.cpp +++ b/clang/tools/libclang/CIndex.cpp @@ -2969,8 +2969,16 @@ CXSourceLocation clang_getCursorLocation(CXCursor C) { } case CXCursor_CXXBaseSpecifier: { - // FIXME: Figure out what location to return for a CXXBaseSpecifier. - return clang_getNullLocation(); + CXXBaseSpecifier *BaseSpec = getCursorCXXBaseSpecifier(C); + if (!BaseSpec) + return clang_getNullLocation(); + + if (TypeSourceInfo *TSInfo = BaseSpec->getTypeSourceInfo()) + return cxloc::translateSourceLocation(getCursorContext(C), + TSInfo->getTypeLoc().getBeginLoc()); + + return cxloc::translateSourceLocation(getCursorContext(C), + BaseSpec->getSourceRange().getBegin()); } case CXCursor_LabelRef: { @@ -3049,8 +3057,7 @@ static SourceRange getRawCursorExtent(CXCursor C) { return getCursorMemberRef(C).second; case CXCursor_CXXBaseSpecifier: - // FIXME: Figure out what source range to use for a CXBaseSpecifier. - return SourceRange(); + return getCursorCXXBaseSpecifier(C)->getSourceRange(); case CXCursor_LabelRef: return getCursorLabelRef(C).second; |

