[cfe-dev] UnqualifiedId copy-constructor fixme

Erik Verbruggen erikjv at me.com
Tue Jan 19 13:08:36 PST 2010


While digging through DeclSpec.h, I noticed that the UnqualifiedId class has a private assignment operator, but a public (and implemented) copy-constructor with a big FIXME:

/// \brief Do not use this copy constructor. It is temporary, and only
/// exists because we are holding FieldDeclarators in a SmallVector when we
/// don't actually need them.
/// FIXME: Kill this copy constructor.

Now it looks like the only place where this is used, is actually Parser::ParseObjCMethodDecl where it is used to hold the parameter declarations in the optional parameter list (line 860 in rev. 93892). Quite easy to kill. However, on line 874 of that file, those parameters are passed to the ActOnMethodDeclaration action callback, which might do something with them... (I guess that when you'd use clang to refactor parameter names, you'd need to use this method to find them).

So, is this copy constructor still eligible for "simple" removal? If so, the attached patch will do that. Or should the parameter declarations still be passed to ActOnMethodDeclaration, but with a different (non-copying) data-structure?

-- Erik.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: unqualified-id-copy-constructor.patch
Type: application/octet-stream
Size: 1694 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20100119/899c33ec/attachment.obj>

More information about the cfe-dev mailing list