PR19352 getLocation() points to the wrong position for FriendDecls

Nikola Smiljanic popizdeh at gmail.com
Wed Apr 16 03:38:50 PDT 2014


LocStart in CheckFriendTypeDecl is the start of DeclSpec range. This is OK
for checking that declaration starts with 'friend' keyword but is redundant
when it comes to FriendDecl creation. Location of the keyword is already
passed as FriendLoc.

I've added another parameter to this function that points to location of
the type from the declaration. The call to CheckFriendTypeDecl from
SemaTemplateInstantiateDecl now isn't technically correct because it's
passing the the type location as LocStart. But the error that's checked for
using this parameter can only happen inside class declaration, not
instantiated template, I think :)

Is there a way to test this? I'm not seeing any regressions.

struct A{};
typedef A Atypedef;

namespace ns { struct B{}; }

template <typename T>
class C
{
friend class A; // points to A
friend Atypedef; // points to Atypedef
friend T; //  points to T
friend decltype(whatever); // points to decltype
friend ns::B; // points to B
friend typename T::something; // points to something
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140416/8ad2e9fb/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr19352.patch
Type: text/x-patch
Size: 2667 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140416/8ad2e9fb/attachment.bin>


More information about the cfe-commits mailing list