[cfe-commits] [PATCH 11/15] Fix Casting

Argyrios Kyrtzidis akyrtzi at gmail.com
Fri Jan 11 11:55:14 PST 2013


On Jan 11, 2013, at 11:37 AM, dag at cray.com wrote:

> Argyrios Kyrtzidis <akyrtzi at gmail.com> writes:
> 
>> On Jan 11, 2013, at 10:31 AM, Dmitri Gribenko <gribozavr at gmail.com> wrote:
>> 
>>> On Fri, Jan 11, 2013 at 8:29 PM, Argyrios Kyrtzidis <akyrtzi at gmail.com> wrote:
>>>> On Jan 11, 2013, at 9:59 AM, Dmitri Gribenko <gribozavr at gmail.com> wrote:
>>>> 
>>>>> On Thu, Jan 10, 2013 at 9:12 PM, David Greene <dag at cray.com> wrote:
>>>>>> Use const_cast<> to avoid a cast-away-const error.
>>>>> 
>>>>> Maybe a helper function template would be better (for all except the
>>>>> first)?  Argyrios?
>>>> 
>>>> How about just adding a function accepting a Decl* and a
>>>> CXCursorKind, and have the others delegate to that.
>>> 
>>> Maybe a const Decl*
>> 
>> Right, this is what I meant sorry.
> 
> Sorry, I'm a bit lost.  :) What piece of code are we talking about?
> This is in CXCursor.cpp, right?  Not all the changes there relate to
> Decl *.

Most of your fixes are in functions creating a CXCursor out of a subclass of Decl; the suggestion here is to add a new function and have the other's call it, e.g:

CXCursor cxcursor::MakeCursorVariableRef(const VarDecl *Var, SourceLocation Loc, 
                                         CXTranslationUnit TU) {
  return MakeDeclCursor(CXCursor_VariableRef, Var, Loc, TU);
}

which is good in general.

> 
>                            -David





More information about the cfe-commits mailing list