This is an archive of the discontinued LLVM Phabricator instance.

Fix `NestedNameSpecifierLoc::getLocalSourceRange()`
Needs ReviewPublic

Authored by eduucaldas on Aug 12 2020, 9:25 AM.

Details

Reviewers
gribozavr2
rsmith
Summary

From the documentation comment above NestedNameSpecifierLoc::getLocalSourceRange()

/// Retrieve the source range covering just the last part of
/// this nested-name-specifier, not including the prefix.
///
/// For example, if this instance refers to a nested-name-specifier
/// \c \::std::vector<int>::, the returned source range would cover
/// from "vector" to the last '::'.

We would expect that for a nested-name-specifier with a dependent template specialization type: T::template ST<int>:: NestedNameSpecifierLoc::getLocalSourceRange() would return template ST<int>:: but instead it returns T::template ST<int>::.

The issue might as well be coming from DependentTemplateSpecializationTypeLoc::getLocalSourceRange() which is
indirectly called from NestedNameSpecifierLoc::getLocalSourceRange(). I couldn't determine what is the intended behaviour for that though.

Diff Detail

Event Timeline

eduucaldas created this revision.Aug 12 2020, 9:25 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 12 2020, 9:25 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
eduucaldas requested review of this revision.Aug 12 2020, 9:25 AM
eduucaldas edited the summary of this revision. (Show Details)Aug 12 2020, 9:29 AM
eduucaldas added a reviewer: gribozavr2.

Don't assume the code is completely correct

Update comment

Unit tests will be provided once we decide that this is the way to go ;)