Provide proper source location and range information for C++ base
specifier cursors in libclang. FIXME -=2, fixes the rest of
<rdar://problem/8274883>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115419 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp
index 908b99d..04d0bc5 100644
--- a/tools/libclang/CIndex.cpp
+++ b/tools/libclang/CIndex.cpp
@@ -2969,8 +2969,16 @@
}
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 @@
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;