[cfe-dev] CFGElement to CFGStmt

David Blaikie dblaikie at gmail.com
Thu Jul 4 09:38:30 PDT 2013


On Thu, Jul 4, 2013 at 9:36 AM, David Blaikie <dblaikie at gmail.com> wrote:
> On Thu, Jul 4, 2013 at 8:38 AM, Vadium <vabrva at gmail.com> wrote:
>> Hi David,
>>
>> I am trying to do the same anikau31 was trying to do, using your code:
>>
>>> +  if (Optional<CFGStmt> CS = E.getAs<CFGStmt>()) {
>>> +    const Stmt *S = CS->getStmt();
>>
>> but I'm getting following error on second line:
>>
>> " error: cannot convert 'clang::CFGStmt::getStmt' from type 'const
>> clang::Stmt* (clang::CFGStmt::)()const' to type 'const clang::Stmt*' "
>
>
> Looks like you wrote:
>
> const Stmt *S = CS->getStmt;
>
> And forgot the '()' where you should've written:
>
> const Stmt *S = CS->getStmt();

(& might I suggest self-hosting Clang as your compiler, in part
because it has better error messages for this particular case (&
others), if my guess is correct & the above is the problem. For
example:

call.cpp:7:24: error: reference to non-static member function must be
called; did you mean to call it with no arguments?
  const foo *f = bar().f;
                 ~~~~~~^
                        ()

>
>>
>> Thank you in advance,
>>
>>
>>
>> --
>> View this message in context: http://clang-developers.42468.n3.nabble.com/CFGElement-to-CFGStmt-tp4031123p4033020.html
>> Sent from the Clang Developers mailing list archive at Nabble.com.
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev



More information about the cfe-dev mailing list